Home › Developer Tools

Regex Tester

Test a regular expression against sample text in your browser, with flag toggles, a live match list and every capture group broken out per match.

0Matches
0Groups captured
0Pattern chars

Matches

Enter a pattern to start matching.

What each flag actually changes

The four checkboxes map one-to-one onto the flags you would otherwise type after the pattern. g decides whether the engine stops at the first match or walks the whole string - without it, a tester shows one hit even when the text contains twenty. i removes case sensitivity, which is the difference between matching AB-1234 and ab-1234. m re-anchors ^ and $ so they mean start and end of a line instead of start and end of the whole input, and s lets a bare . cross newlines, which multi-line JSON and log dumps need constantly.

Capture groups are listed under each match in numbered order, so group 1 is the first opening parenthesis in your pattern. Named groups appear under their name rather than a number, which makes it obvious when a group is meant to be referenced later in a replacement string.

Usage example

You are pulling order references out of a support transcript. Paste the transcript below, use the pattern \b[A-Z]{2,3}-\d{4,6}\b with g on, and the match list shows every reference with its position. Turn i on if the export lowercases some of them - a common result of copy-pasting out of an email client - and the count stays the same instead of dropping to whatever subset kept its capitals.

The tester is also the cheapest way to catch an over-broad pattern before you put it in code: if a pattern written to find order numbers also swallows dates and invoice totals, the match list makes that visible immediately. Once the pattern behaves, move it into your pipeline, or clean the extracted strings with the duplicate line remover before comparing two extraction runs.

Frequently asked questions

Is my test text sent anywhere?

No. The pattern runs in your browser against the text you pasted, and neither is transmitted anywhere. Paste production data with the same caution you would use in any local editor, but nothing here is uploaded.

Why does the match count stop at a certain number?

The loop is capped at 5,000 matches so that a broad pattern like .* against a large paste cannot lock the tab. If you hit the cap, the pattern is almost always too permissive - tighten it rather than raising the limit.

Does it support lookbehind and named groups?

Yes. The page uses your browser's own regular expression engine, so lookbehind ((?<=...)), named groups ((?<name>...)) and unicode property escapes all work on any browser that supports them.

Related tools

Text Diff

Compare two blocks of text line by line with a proper longest-common-subsequence diff.

Duplicate Line Remover

Remove duplicate lines from any list or export, with case-sensitive and whitespace-trim options.

JSON Formatter

Format, validate and beautify JSON with error reporting and stable key ordering.