WebTools

Regular expression tester

Highlighted matches, named groups and live replacement.

Test a regular expression against some text and see the matches highlighted, the position of each one, and the contents of the groups, both numbered and named.

Type a replacement and you see it applied live, with $1, $2 and $& references. It is the JavaScript engine doing the work, so what works here works the same in your code.

How to use it

  1. Write the pattern and tick the flags.
  2. Paste the test text.
  3. If you need it, write the replacement and watch the result.

Frequently asked questions

Which flags are there?
g to find them all, i to ignore case, m so ^ and $ work line by line, s so the dot includes line breaks, and u for full Unicode mode.
Why do I only get one match?
Because the g flag is off. Without it a regular expression stops at the first one.
Do these expressions work in Python or PHP?
The basics do, but the details differ. Named groups, lookbehind and Unicode classes have different syntax or support depending on the language.

Related tools