Monday, December 2, 2013

Regular Expression

a good place to study:  http://www.zytrax.com/tech/web/regex.htm#intro

Bracket, range, negation
[]    indicate a rage, one and only one matching
-     range
^    inside [] means negate the expression

Anchors
^     Beginning
$     Ending
.      Any char at THIS position

Iteration
?           0 or 1
*          0 or more
+          1 or more
{n}       exactly n times  
{n,m}   appears at least n, at most m times
{n,}      at least n times

Other
()     grouping
|      or, alternation

Abbreviations
\d     digit
\D    not digits
\s     space
\S    not space
\b    boundary of words
\B   not boundary
\w   0-9, A-Z, a-z
\W not \w

No comments:

Post a Comment