Regular Expressions

Matching type

Code Meaning
\w Alphanumeric Character
\W Non-Alphanumeric Characters
\s White Space
\S Non-White Space
\d Digits
\D Non-Digits
\b Word Boundary
\B Non-Word Boundary
\A or caretAt the Beginning of a String
\Z or $ At the End of a String
. Match Any Single Character

Modifiers

Code Meaning
* Zero or More Occurrences
? Zero or One Occurrence
+ One or More Occurrences
{ N } Exactly N Occurrences
{ N,M } Between N and M Occurrences
.* <thingy> Greedy Match, up to the last thingy
.*? <thingy> Non-Greedy Match, up to the first thingy
[ set_of_things ] Match Any Item in the Set
[ caret set_of_things ]Does Not Match Anything in the Set
( some_expression )Tag an Expression
$1..$N Tagged Expressions used in Substitutions

References

 
general/unix/perl/regular_expressions.txt · Last modified: 02.05.2008 17:32 by 130.85.181.194
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki