Test and debug regular expressions in real-time.
The Regex Tester checks that a regular expression is valid and shows every match in your sample text, highlighted, with its position and capture groups. It uses your browser's JavaScript regex engine and reports syntax errors immediately.
Made for developers. Typical uses:
The pattern \b[\w.+-]+@[\w-]+\.[\w.]+\b on "Contact ada@example.com or grace@navy.mil today." highlights two matches, ada@example.com at position 8 and grace@navy.mil at position 27. The pattern (\d{4})-(\d{2})-(\d{2}) on "2026-10-05 and 1999-12-31" finds two dates with the year, month and day as groups.
It runs the JavaScript regex flavor. Other languages (PCRE, Python, Java) differ on features such as lookbehind and possessive quantifiers.
Accuracy: Output is tested against known inputs. For production code, review the result and run your own tests.
Expert Tip
Build a pattern in small steps: start with the simplest version that matches, add one rule at a time, and keep a few sample lines that should not match as well as those that should.
A regular expression is a pattern for finding text. The Regex Tester checks that your pattern is valid, then highlights every match in your sample text and lists each match with its position and its capture groups. Syntax errors are reported straight away. You can type a pattern and set the flags yourself, or paste a full literal such as /abc/gi and the tool reads the pattern and flags from it.
Flags change how matching works. The tool accepts the JavaScript flags d, g, i, m, s, u, v and y, and starts with g.
To find email-like text, the pattern \b[\w.+-]+@[\w-]+\.[\w.]+\b applied to "Contact ada@example.com or grace@navy.mil today." matches ada@example.com at position 8 and grace@navy.mil at position 27.
Capture groups pull out parts of a match. The pattern (\d{4})-(\d{2})-(\d{2}) applied to "2026-10-05 and 1999-12-31" matches both dates, and the groups give the year, month and day of each: 2026, 10, 05 and 1999, 12, 31.
A short vocabulary covers most patterns.
The flavour matters: this tester uses the JavaScript engine, so features such as possessive quantifiers differ from PCRE, Python or Java. Quantifiers are greedy by default, so .* grabs as much as it can; add a question mark (.*?) to take as little as possible. Forgetting to escape a dot makes a pattern match too much. Nested repetition such as (a+)+ can take extremely long on certain inputs, so keep patterns simple. If you need the pattern as a string for code, the Regex to String tool escapes it correctly.
For a deeper check on email addresses, see why a pattern is not enough in what validators catch and what they miss. The Email Validator applies stricter rules. Everything runs in your browser.
Write test lines that should match and lines that should not, including edge cases such as empty input, extra spaces and unusual characters. A pattern that finds what you want in one sample may also find things you do not want in another. Check the position of each match, because an off-by-one error is easy to miss, and re-run the test with the g and i flags switched on and off to see how the result changes.
Syntax and format checks find broken markup, bad JSON and mistyped numbers, but not meaning, business rules, email deliverability or whether a URL is alive.
Explore more in Developer Tools, read the guides and articles, or see how we test our tools.
Encode text and data to Base32 format.
Best for generating or inspecting a Base32-encoded TOTP secret key for two-factor authentication setup
Encode and decode Base64 strings instantly.
Best for encoding binary data for email and web transmission
Check color contrast ratios for WCAG compliance.
Best for checking that body text color meets WCAG AA contrast requirements before shipping a website
Parse and understand cron expressions with human-readable descriptions.
Best for confirming a scheduled job in a server crontab actually runs when you think it does before deploying it
Convert external CSS to inline styles for HTML emails.
Best for converting a designed HTML email template into inline-styled markup before sending a campaign
Format and beautify messy CSS code with proper indentation.
Best for beautifying minified CSS for editing
Convert regular expressions to plain string patterns.
Best for storing a regex pattern as a string field in a JSON config file