Dec 15 2006
Regex Notes
Regular expressions (regex) let you search for a particular pattern. Regex consist of literal characters, and special characters, also called meta characters. Regex syntax has 2 modes, one inside of character classes, which is inside [ ] and one outsided of character classes.
Character classes []: Regex inside [] are in different mode and have different syntax. It matches a single character specified as a list, range or class shortcut. 03[-./]19[-./]76 Will match the above date delimited by a dot or a hyphen. Inside [] the dot is no longer a meta-character, its matched literally! Negation Operator ^ f[^u] matches something with f, followed by any character other then u Character classes shortcuts \d [0-9] digit \D non digit \w [a-zA-Z0-9_] part of word \W non word \s [ \t\n\r\f\v] whitespace \S non whitespaceAlternation: | operator is 'or' Jeff(re|er|izz)y => Jeffrey, Jeffery, JeffizzyConditionals: (?if then | else) if the "if" part is true, "then" expression is attmpted, otherwise "else" is attempted (?if then) else condition is optional, so is the pipe character prefixing itAnchors: ^ beg of line $ end of line \b word boundary \B non-word boundary Ruby: \A begining of a string \Z end of string (or before newline at the end) \z end of stringOptional Items: ? optionally matches a character before it, or you can specify a group() of characters before it: colou?r will match color and colour 4(th)? will match 4 and 4thRepetitions: + s1 or more times * 0 or more times ? 1 or 0 times {n} match exactly n times {min, max} min to max times {min,} at least min {,max} at most max (ruby)Backreferences: First matched group (): sed, vi: \1 ruby: $1 php: $m[1] python, java: m.group(1) c#: m.Groups[1] Group zero is typically the entire matchEscape: \. will escape dot meta characterMore Info: http://www.regular-expressions.info/

August 17th, 2011 at 11:57 am
This is such a great resource that you are providing and you give it away for free. I love seeing websites that understand the value of providing a quality resource for free. It’s the old what goes around comes around routine.
September 12th, 2011 at 2:57 am
I’m still learning from you, as I’m trying to achieve my goals. I certainly liked reading everything that is posted on your site.Keep the information coming. I enjoyed it
October 20th, 2011 at 9:15 am
abercrombie deutschland
October 20th, 2011 at 9:16 am
abercrombie and fitch uk
October 20th, 2011 at 9:19 am
burberry outlet
October 20th, 2011 at 9:20 am
burberry uk
November 1st, 2011 at 2:18 pm
what a great post! i really like it and wanted to say thanks for sharing!
December 14th, 2011 at 9:09 am
If you are looking at purchasing on your own Mulberry Outlet bags that are the perfect example for luxurious, modernity and trend then you definitely should check out the latest assortment of Mulberry Handbags. These baggage will certainly treat all your senses, and you will probably not just look like but in addition seem like a way superstar.
January 2nd, 2012 at 7:55 am
I certainly liked reading everything that is posted on your site.Wallpapers 1012 Keep the information coming. I enjoyed it
January 5th, 2012 at 6:26 pm
Great work! Thanks for sharing.
January 14th, 2012 at 6:53 am
555yxj
This is highly informatics, crisp and clear. I think that Everything has been described in systematic manner so that reader could get maximum