RegexLab - free, no upload, runs in your browser

Test regular expressions live in your browser

RegexLab is a live regular expression tester: type a pattern and test text and every match is highlighted instantly, with a table of matches, indexes, and capture groups, plus a match count and pattern metrics. All evaluation happens in your browser, so patterns built against production data stay private.

Why a regex tester should run locally

The patterns people test are usually built against real production data - server logs, user records, or payment references. Online regex testers evaluate that text on their own servers, and many log the patterns for their own training. Running the test locally means your data and your pattern both stay on your machine.

RegexLab uses your browser's native RegExp engine, so a pattern that passes here will behave identically in Node.js and modern JavaScript.

Read the table, not just the highlight

The highlight shows you where matches land; the table shows you what they actually captured. Each row lists the match, its start index, and every capture group - the part that catches mistakes like a group that captures more than intended, or a quantifier that swallows the next field.

The metrics row reports the match count and test length at a glance, so a pattern that matches zero or matches-everything is obvious immediately.

How to test a regular expression

Debug a regex without melting your browser

Most regex disasters are not syntax errors; they are patterns that backtrack exponentially. Nested quantifiers like (a+)+ and greedy wildcards over long input can freeze a tab. Start with anchors and specific character classes, then loosen the pattern only as far as the tests require.

Test with realistic strings, not just the one example that inspired the pattern. Include an empty string, a very long line, Unicode text, and a near-miss that should not match. If the pattern is meant to validate a whole field, anchor it with ^ and $; otherwise it will happily match a substring.

Regex review checklist

Frequently asked questions

Which regex syntax is supported?

The JavaScript engine (ECMAScript regex). That is the same engine used in Node.js and modern browsers, so a pattern that works here works there.

What flags can I use?

g (global), i (case-insensitive), m (multiline), s (dotall), and more - type them into the Flags field.

Does it show capture groups?

Yes. Every match row lists its capture groups, so you can verify exactly what group 1, 2, and beyond captured.

Is my test text uploaded?

No. Pattern evaluation runs in your browser with the native RegExp engine. Nothing is transmitted.

Is there a limit on matches?

The tool highlights and tabulates up to 5,000 matches and shows the first 200 in the table, which covers realistic test cases.

Why does my regex match part of a word?

The pattern is not anchored. Add word boundaries (\b) or start/end anchors (^ and $) so it only matches the intended token.

Should I use regex to parse HTML or JSON?

No. Use a DOM parser or JSON parser. Regex is fine for simple text extraction, but nested markup and escaped strings defeat it quickly.

Can I test a regex against a file?

Paste a sample of the file into the test area. For very large files, test with representative lines rather than the entire document.

Why do my groups show empty matches?

Optional groups can match nothing. Check the group index and whether the surrounding pattern requires the group to participate.

Related local tools