Regex Tester
Regex Tester runs a regular expression against test text live: it highlights matches in the text, lists capture groups and named groups, replaces matches with other text using $1 / $<name>, explains the pattern piece by piece and offers ready-made patterns such as email, URL and IP. It also gives the same pattern as JavaScript, Python, PHP, Java, C#, Go and Ruby code. Very slow (ReDoS) patterns run in a separate worker, so they cannot freeze the page.
How it works
- 1Write the pattern and toggle the flags (g, i, m, s, u, y) with the buttons.
- 2Paste the test text: matches are highlighted in the text and listed with their positions.
- 3In the “Replace” tab enter the replacement ($1, $<name>, $&) and copy the result.
- 4Use the “Explain” tab to understand the pattern, pick one from the “Pattern library”, and grab the code in your language from the “Code” tab.
Frequently asked questions
Which regex dialect is supported?−+
JavaScript's built-in `RegExp` engine (ECMAScript regex syntax); there may be minor syntax differences from PCRE or Python regex. The Code tab outputs do not change the pattern itself, so small differences may appear in the target language's engine.
What do the common flags do?−+
g: find all matches (otherwise only the first); i: case-insensitive; m: ^ and $ match the start/end of each line; s: . also matches line breaks; u: Unicode; y: sticky matching.
What does “The pattern ran too slowly” mean?−+
Some patterns (such as nested repeats like (a+)+$) take exponential time on certain input; this is called ReDoS. The tool runs the pattern in the background with a 1.5 second limit and stops it if exceeded; you need to simplify the pattern.
How do I use groups in a replacement?−+
$1, $2 … insert numbered groups, $<name> a named group (defined with (?<name>…)), $& the whole match and $$ a dollar sign.
How are zero-width matches handled?−+
For patterns that can match empty, such as `a*`, the tool advances to the next character so it scans the whole text without getting stuck. At most 1000 matches are shown.
Is my text sent to a server?−+
No, everything runs in your browser.
Embed on your site
<iframe src="https://toolsqube.com/en/code/regex-tester/embed" width="480" height="360" style="border:0;border-radius:14px" title="Regex Tester · ToolsQube" loading="lazy"> </iframe>
Want to go deeper on this topic: Developer Tools Guide →