Matches any character except newline.
A quantifier. Matches 0 or more of the previous character.
A quantifier. Matches 0 or 1 of the previous character.
A quantifier. Matches 1 or more of the previous character.
matches any character between a and z, inclusive.
Matches any character between A and z. Note that this includes several non-alphabetical characters, including braces. See this ascii table for the full listing.
Matches any upper or lowercase character or any number.
Matches any character except for a, b or c. The carat (^) at the beginning is what inverses the match.
Match start of line.
Match end of line.
Escape any special characters using the backslash. For example, if you want to match a literal dollar sign ($) instead of the end of a line, use \$.
Matches whitespace. Specifically, it matches:
' ' - space
' ' - tab
'\n' - line break
\d
\w
Suppose you want to match an "a" in the string, but only if it is not followed by "ditya". You can do this with negative lookaheads:
a(?!ditya)
Now suppose you want to find "watterson" in the string, but only when it is not preceded by "bill ". Use a negative lookbehind:
(?<!bill )watterson