Regular Expression Pocket Reference: Regular Expressions For Perl, Ruby, Php, Python, C, Java And .net (pocket Reference (oreilly))

Preparing link to download Please wait... Download

E-Book Overview

Trying to remember the subtleties of all of the different implementations of regex is no longer a problem with this around. Whip it out and instantly you've got access to all of the meta-characters, etc., etc., etc. What more can I say?

E-Book Content

Constant width Constant width italic Constant width bold foo|foobar cat|category alert backspace escape character form feed newline carriage return horizontal tab vertical tab \n \b backspace \b backspace \num \015\012 \xnum \x{num} \unum \Unum \x0D\x0A \cchar char \cH [...] [^...] [...] [^...] [a-z] . \w \d \s \W \D \S \s \S \d [0-9] [:alnum:] [[:lower:]] [:lower:] [a-z] Alnum Alpha Blank Cntrl Digit Graph Lower Print Punct Space Upper Xdigit \p{prop} \P{prop} Is a In \p{Ll} α \X \P{M}\p{M} \X e' è; \p{L} \p{Ll} \p{Lm} \p{Lo} \p{Lt} \p{Lu} \p{C} \p{Cc} \p{Cf} \p{Cn} \p{Co} \p{Cs} \p{M} \p{Mc} \p{Me} \p{Mn} \p{N} \p{Nd} \p{Nl} \p{No} \p{P} \p{Pc} \p{Pd} \p{Pe} \p{Pi} \p{Ps} \p{Pf} \p{Po} \p{Ps} \p{S} \p{Sc} \p{Sk} \p{Sm} \p{So} \p{Z} \p{Zl} \p{Zp} \p{Zs} ^ \A ^ \A $ \Z \z $ $ \Z \z \G \G \b \B \< \=""> \b \B \ \> (?=...) (?!...) (?.*) Subject subject (?>...) (?>[ab]*)\w\w aabbcc aabbaa ...|... \b(foo|bar)\b foo bar (?(if)then |else) if then else if else then (|bar) foobar * + ? {num num } (ab)+ ababababab *? +? ?? {num num }? (an)+? an banana *+ ++ ?+ {num num }+ (ab)++ab ababababab \w è; e /pattern/mode s/pattern/replacement/mode s/^\s+// s/\s+$// foo bar foo "foo bar" /^\d{1,6}$/ 42 678234 10,000 /^#([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?$/ #fff #1a1 #996633 #ff FFFFFF /^\d{3}-\d{2}-\d{4}$/ 078-05-1120 078051120 1234-12-12 /^\d{5}(-\d{4})?$/ 94941-3232 10024 949413232 /^\$\(d{1,3}(\,\d{3})*|\d+)(\.\d{2})?$/ $20 $15,000.01 $1.001 $.99 /^\d\d\/\d\d\/\d\d\d\d \d\d:\d\d:\d\d$/ 04/30/1978 20:45:38 4/30/1978 20:45:38 4/30/78 /^.*\// /usr/local/bin/apachectl C:\\System\foo.exe /^(\d|[01]?\d\d|2[0-4]\d|25[0-5])\.(\d|[01]?\d\d|2[0-4] \d|25[0-5])\. (\d|[01]?\d\d|2[0-4]\d|25[0-5])\.(\d|[01]?\d\d|2[0-4] \d|25[0-5])$/ 127.0.0.1 224.22.5.110 127.1 /^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/ 01:23:45:67:89:ab 01:23:45 0123456789ab /^[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z_+])*@([0-9a-zA-Z][-\w]* [0-9a-zA-Z]\.)+[a-zA-Z]{2,9}$/ [email protected] example.museum [email protected] /(https?):\/\/([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+ [a-zA-Z]{2,9}) (:\d{1,4})?([-\w\/#~:.?+=&%@~]*)/ http://foo.com:8080/bar.html \a \b \e \n \r x1B x0A x0D x0D x0A \f \t x0C x09 \octal \xhex \x{hex} \cchar \N{name} PATH_TO_PERLLIB/unicode/Names.txt charnames ':full' use [...] [^...] [ class:] . /s \C \X \w \W \d \D \s \S \p{prop \P{prop \p{IsWord} \P{IsWord} \p{IsDigit} \P{IsDigit} \p{IsSpace} \P{IsSpace} ^ /m \A $ /m \Z \z \G \b \B (?=...) (?!...) (?...) (?'name'...) \k \k'name' %+