Regular Expressions

Special Chars

\r return

\n line feed

\s space

\w word char

\d number

Anchors

^ \A Match beginning

$ \Z Match end

\b Match word boundary

Misc

*? Lazy match

?: Don’t capture

Look ahead, behind

q(?!u) Negative lookahead, find q not followed by u

q(?=u) Positive lookahead, find q followed by u but don’t match u

(?<!a)b Negative lookbehind. Matches b that is not preceeded by a

(?<=a)b Positive lookbehind