RegEx Tutorial

Group Meta-Characters
[ ] Matches any character in the set
[^ ] Matches any character not in the set
( ) Defines a capture group
(?: ) Groups without capturing
(?= ) Positive lookahead
(?! ) Negative lookahead
| Matches either the expression
before or after it
\n Refers to the n-th group
$n Refers to the n-th group
(within a replace only)
$0 Refers to the entire result
(within a replace only)
Position Meta-Characters
^ Beginning of line
$ End of line
\A Beginning of a string
\z End of a string
\b Word boundary
\B A non-word boundary
Single Meta-Characters
. Any character except newline
\d Any digit [0-9]
\D Any non-digit [^0-9]
\w Any word character [A-Za-z0-9_]
\W Any non-word character [^A-Za-z0-9_]
\s Any whitespace character
(space, tab, new line, form feed,
end of line, carriage return)
\S Any non-whitespace character
Quantifiers
(How many times the
previous character appears)
? Once or not at all (0-1)
* Zero or more times (0+)
+ One or more times (1+)
{n} Exactly n times
{min,} min or more times
{min,max} At least min times, but
not more than max times
(Quantifier)? Make the quantifier not greedy

RegEx Testing



RegExp:
Replacement:
String:
Global: Case Sensetive: