Regex Tester
Test regular expressions live with highlighted matches and match counts. Free online regex tool for developers.
Free · No sign-upHow to use Regex Tester
- 1. Type your regular expression between the slashes, or choose one from Common patterns, such as Email, URL, US phone, US ZIP, UUID or IPv4.
- 2. Toggle the flags g, i, m, s, u and y, then paste your test string. Matches are highlighted as you type.
- 3. Check the Matches tab for a table of groups, test substitutions in Replace with $1 or $<name>, and read Explain for a plain-English breakdown.
- 4. Open the Code tab to copy JavaScript, Python or PHP snippets, or click Copy share link to send the pattern and flags to a teammate.
Frequently asked questions
Is the regex tester free, and is there a limit on matches?
It is free with no sign-up. The match table lists up to 500 rows, and up to 5,000 matches are counted. Each test is stopped after 2 seconds to keep the page responsive, and highlighting is skipped for test strings over 300,000 characters.
Is my test data private when I use the regex tester?
Yes. Patterns run in a Web Worker in your browser and nothing is sent to our server. The share link puts only the pattern, flags and replacement in the part of the URL after the #, which browsers don’t send to servers, and it never includes your test string.
Why does my regex freeze or time out?
Patterns with nested quantifiers, such as (a+)+, can cause catastrophic backtracking, where the engine tries millions of paths. The tester stops any run after 2 seconds and warns you. Make quantifiers more specific or restructure the pattern to fix it.
How do I use named capture groups in a JavaScript regex?
Open the group with a question mark followed by the name in angle brackets; the Date YYYY-MM-DD preset shows year, month and day groups. The match table labels columns by name, Replace accepts a dollar sign plus the bracketed name, and the Code tab converts groups to Python’s ?P syntax.
How do I match a US phone number with regex?
Pick US phone from Common patterns. It matches 10-digit numbers with optional parentheses around the area code and dashes, dots or spaces, such as (415) 555-0132 or 415.555.0132. Edit the pattern to add a +1 country code if you need it.
Which regex flavor does this tester use?
It uses your browser’s JavaScript (ECMAScript) regex engine, so results match Node.js and front-end code. The Code tab provides Python and PHP versions, but those engines differ slightly, for example in lookbehind support, so test edge cases in the target language.