Regex Tester
Test JavaScript patterns, inspect groups, or preview replacements.
Runs in your browser. Nothing is uploaded.
Test regular expressions privately
TheDevTab gives you a focused JavaScript regex tester. Your pattern and test string stay in your browser while you work. Use Test to inspect matches and Replace to preview replacement text.
Use g for every match, i to ignore case, m for line anchors, s for dot matches across line breaks, and u for Unicode-aware matching.
Flags change the question you are asking
The g flag returns every match instead of stopping at the first one. Use i when letter case should not matter, and m when ^ and $ should work on each line rather than only the full string. The s flag lets a dot include line breaks. The u flag enables Unicode-aware behavior. Test the same pattern with and without a flag when a result seems surprising.
Matching uses the JavaScript RegExp engine supplied by the browser. Syntax from PCRE, Python, or another engine may not work here. The tester shows matches and errors for a focused JavaScript check.
Keep patterns specific
Some patterns become very slow when nested repetition and overlapping alternatives create many possible paths. This is called catastrophic backtracking. This page runs Test and Replace off the main thread and stops a run that takes too long, so the tab should stay usable. Still prefer clear boundaries and bounded repetition before putting a pattern in a request path or a log processor.
Review the match before using it
Start with a sample that includes a match, a near miss, and an empty line. Check whether the global flag is enabled, inspect the exact matched text, then copy the pattern into your code with the same flags. A near miss can be as useful as a successful match when checking boundaries and optional groups.
FAQ
Is the regular expression executed on a server?
In a normal browser, each test or replacement runs in a short-lived Web Worker in your browser, so the pattern and test string are never uploaded. The client terminates a worker after 500 ms; global matching also stops after 100 ms or 2,500 matches, while environments without Worker support use a synchronous fallback.
Which regular expression syntax does this tester use?
It uses the JavaScript RegExp engine supplied by the browser, so syntax and supported features follow that runtime. Test reports matches and capture groups, while Replace applies the replacement string once or globally when g is enabled.
What do the regex flags mean?
g finds every match, i ignores letter case, m changes how ^ and $ work across lines, s lets a dot match line breaks, and u enables Unicode-aware matching. These are the five flags exposed by the tool, in the order gimsu.
How does Replace differ from Test?
Test returns each match's index, full text, numbered groups, and named groups when present. Replace returns the transformed test string, using JavaScript replacement syntax and either the first match or every match when g is enabled.
Can a regular expression become slow?
Yes. Nested repetition and overlapping alternatives can cause catastrophic backtracking on some inputs. The worker boundary and timeout keep a normal browser tab from being held by one job permanently, but patterns should still be specific and tested with realistic input.
What happens when a global pattern matches too much?
Global Test stops with an error after 2,500 matches instead of building an unbounded result list. A global pattern that produces no progress is also advanced after an empty match so the loop can continue safely.