Regular Expression Tester With Match Highlighting

Test regular expressions against sample text with live match highlighting.

Frequently asked questions

Which regex flavor does this use?

JavaScript's native RegExp engine, the same one used in browsers and Node.js.

Can I see capture groups from each match?

Yes, every match lists its full text along with the values of its capture groups. Groups that did not take part in a match are left out.

Do I need to put slashes around the pattern?

No. Type just the pattern, such as \d+, and set flags with the checkboxes. If you paste /\d+/g, the slashes are treated as characters that must appear in the text.

Why does my pattern show only one match?

Check that Global (g) is ticked. Without it the tester stops after the first match, exactly like a JavaScript regex that lacks the g flag.

How can I test a Pakistani mobile number or CNIC?

Try \b\d{5}-\d{7}-\d\b for a CNIC with dashes and 03\d{2}-?\d{7} for a local mobile number such as 0300-1234567. These check the shape only, not whether a number or CNIC actually exists.

Can I replace text with this tool?

No. It finds and highlights matches but has no replacement field. Build and test the pattern here, then apply it in your editor or code.