Regex Tester
Test a regular expression against sample text and see every match with its position, capture groups, and named groups highlighted inline in place.
How to use
- Type the pattern without the surrounding slashes.
- Paste the text to test in the second box.
- Read the highlighted matches and the numbered list below.
A regex tester runs a pattern against text and shows every match with its index, capture groups, and named groups. It uses the browser RegExp engine, so the results match what your own code will do.
Enter a pattern and some text.
Matches
Questions about regex tester
- Which regex flavour do I get?
- The JavaScript flavour, since that is what browsers run. Lookahead and lookbehind work, named groups use the question mark and angle bracket syntax.
- Why do I need the global flag for every match?
- Without it the engine stops after the first match. The g flag reports all of them.
- How do I escape a slash in my pattern?
- Use a backslash before it, for example a slash followed by a forward slash. Writing a forward slash alone also works here because the pattern field has no delimiters.
Related tools
- JavaScript Formatter Re-indent JavaScript with consistent braces and line breaks, using a tokenizer that keeps...
- String Escape Tool Escape and unescape a string for JSON, JavaScript, URL, or SQL, covering backslashes, quot...
- Slug Generator Turn a title into a clean URL slug by stripping accents, folding punctuation into words, a...