Regex Tester
Test regular expressions against sample text in your browser and inspect matches while refining a pattern.
Regex Tester online
Test a regular expression against sample text in your browser — see every match, and how the i and m flags change the outcome — before the pattern goes anywhere near production code.
How to use this tool
- Write your pattern in the Regular Expression field (without slashes).
- Paste the text to test against, and set flags: i for case-insensitive, m for multiline anchors.
- Click Test Regex and read the matches in the result.
Common uses
Developing validation patterns for forms and parsers, checking a pattern against real log lines before adding it to a filter, extracting structured bits (dates, IDs, amounts) from unstructured text, and learning regex behaviour by experiment instead of by error.
How it works
The tester compiles your pattern with the browser's RegExp engine — the JavaScript flavour of regex — and runs it over the test text, listing the matches it finds. The two flags offered change semantics, not syntax: i folds case, and m makes ^ and $ match at line boundaries instead of only at the text's ends. Global matching is implied for the match listing, so every occurrence is reported, not just the first.
Worked example
The pattern \b\d{4}-\d{2}-\d{2}\b against the text Shipped 2026-10-05, due 2026-10-19, ref 123-45 matches exactly two dates — the reference number fails the four-digit opening group and is ignored. Add the m flag and the anchored pattern ^Error starts matching at the head of every line of a log, not only the very first — the flag most often missing when a pattern "works here but not in my file".
Privacy and browser processing
Testing runs in your browser with JavaScript — your pattern and text are never uploaded.
Frequently asked questions
Why does my pattern match in code but not here (or the reverse)?
Flavour differences are the usual cause: this tester is JavaScript regex — no lookbehind restrictions in modern browsers, but also no \A, no possessive quantifiers and no named groups with (?
What does the m flag really change?
Only the anchors: without m, ^ matches solely at the start of the whole text and $ at the very end (or before a final newline). With m, they also match at every line break. Patterns without anchors are unaffected by the flag.
Can I test capture groups?
Matches are listed as full matches. For group-level work during development, the browser console (text.match with a named pattern) or a dedicated group visualiser goes deeper; this tester answers "does it match, and where" quickly.
Is a catastrophic-backtracking pattern dangerous here?
It can freeze the tab — a pattern like (a+)+$ against a long non-matching string makes the engine explore exponentially many paths. It harms nothing beyond the page (close the tab), but it is exactly the behaviour to discover here rather than in a server handling user input.
Is my text uploaded?
No. The pattern runs in your browser against your text locally; nothing is sent anywhere.