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
- Write the pattern and tick the flags.
- Paste the test text.
- 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
Minify CSSCSSO: it restructures and merges rules, not just strips spaces.
Minify JavaScriptTerser in the browser, with optional name mangling.
Count words and charactersA live count, reading time and the limits each platform imposes.
Change letter caseUPPERCASE, lowercase, Title Case, camelCase, snake_case and more.
Sort and clean up linesSort, drop duplicates and blanks, number or reverse a list.