PERL 5: Regular Expressions

       
    A regular expression is a pattern -- a template -- to be matched against a string.

     
    . Any single character except newline (\n)
    [abcde] Any single one of the characters enclosed in the square brackets.
    [a-z] a-z is equivalent to all of the 26 low-case characters.  - indicates the range.
    [^a-z] Match any single letter except a-z.^is a negated character when used right after [.
    \d [0-9]
    \w [a-zA-Z0-9_]
    \s \r\t\n\f
    \D [^0-9]
    \W [^a-zA-Z0-9_]
    \S [^ \r\t\n\f]
    a* * indicates "0 or more" of the immediately previous character (a in this example), or character class.
    a+ + indicates "1 or more" of the immediately previous character (a in this example), or character class.
    a? ? indicates "0 or 1" of the immediately previous character (a in this example), or character class.
    a{5,10} {5,10} indicates "5 to 10" of the immediately previous character (a in this example), or character class.  One or the boundaries can be omitted.
    a(.)b(.)c\2d\1 match an a, a non-newline character (call it #1), a b, another non-newline character (call it #2), a c, the character #2, a d, and the character #1.
    abc|defg match abc or defg
    fred\b \b indicates a word boundary
    fred\B \B indicates NOT a word boundary
    ^fred ^ indicates the beginning of a string.  It needs to appear as the first character
    fred$ $ indicates the end of a string.  It needs to appear as the last character