The Regular Expression Playground is old. There are much better tools now. If you are looking for a tool to
test regular expressions, I recommend regular expressions 101.
Show matches/substitutions
Ignore case (i)
Global (g)
Multi-line (m)
. matches any character
\d, \w, and \s match digit, word character, and whitespace
\D, \W, and \S (negate) match non-digt, non-word character, and non-whitespace
+ one or more times
* zero or more times (greedy)
*? zero or more times (lazy)
? zero or one time
^ matches beginning of line
$ matches end of line
{n,m} n to m times (inclusive), {n}exactly n times
[0-9] or [ABCdef] matches one character in set
[^0-9]+ leading circumflex (^) negates, so matches one or more non-digits
| match either pattern to left or pattern to right
() to define groups (referenced as $1, $2, ...)
\ for literal next character — e.g., \? for literal question mark and \\ for backslash (\)
Enter a regular expression (e.g., [A-Z]+ ) and matches
within the text will be highlighted. Acceptable formats:
m/pattern/flags (leading m is optional) — for pattern matching
s/from/to/flags to perform substitutions
Anything else is treated as a pattern for matching (and flags are determined by the checkbox options to the right)
The text matched by parenthetical groups will appear on the right.
Enter a regular expression with Show matches/substitutions
unchecked to quiz yourself. Then check the box and see if you guessed correctly.
NOTE: This is only a playground. Regular expressions
in JavaScript have limitations (e.g., .*
doesn't match newlines). Play here, but always
test your regular expressions in a real programming
environment — like perl.
This playground has been tested in MSIE 6.0 and Firefox 1.0.2;
your mileage may vary.