Free · No sign-up · Runs 100% in your browser

Regex Tester – Test Regular Expressions Online

Write a pattern, paste your text and see every match highlighted instantly. This regex tester shows capture groups, named groups, live replace output, a plain-English explanation of your expression and ready-to-paste code for JavaScript, Python, PHP, Java, C# and Go.

Live match highlightingCapture & named groupsReplace previewPattern explainerNothing is uploaded
Highlighted matches

Why this regex tester beats the usual options

Most online regular expression testers either bury the result in a cluttered IDE-style layout or give you a bare input box with no feedback. This one is built around a single question: does my pattern do what I think it does?

Instant, zero-lag matching

Results update as you type with no build step, no loading spinner and no server round-trip. Even long test strings stay responsive.

Every match, group and index

See the match number, character index, full match, numbered capture groups and named groups in one readable list instead of a cramped tooltip.

Plain-English explainer

The Explain tab breaks your expression into tokens and tells you what each piece actually does, so you learn the syntax while you debug it.

Live replace preview

Test a search-and-replace with backreferences and see the rewritten text before you run it against real data.

Copy-ready code

Export your finished pattern as a working snippet for JavaScript, Python, PHP, Java, C# or Go with the escaping already handled.

Private and mobile-friendly

Your pattern and text never leave the browser, and the whole tool is usable one-handed on a phone — something most regex sites still get wrong.

How to use the regular expression tester

  1. Enter your pattern

    Type the expression between the slashes, or pick a ready-made pattern such as email, URL, IPv4 or date from the dropdown to start from a working example.

  2. Choose your flags

    Toggle g, i, m, s, u and y. Most bugs come from a missing global or multiline flag, so try switching them if a match is missing.

  3. Paste your test string

    Drop in real sample data — a log line, a CSV row, an HTML snippet. The highlighted panel marks each match in alternating colours so adjacent matches stay readable.

  4. Check matches and groups

    Open the Matches tab to confirm the index and captured groups. Use Explain if a token is behaving unexpectedly.

  5. Test a replacement

    Switch to Replace, use $1 or $<name> to reference groups, and confirm the output before using it in your editor or script.

  6. Copy the code

    Open the Code tab, pick your language and paste the generated snippet straight into your project.

What you can do with it

  • Validate email addresses, URLs, phone numbers, postcodes and IDs before they reach your database.
  • Debug a pattern that works in one language but silently fails in another.
  • Extract values from log files, scraped HTML, CSV exports and API responses.
  • Build safe find-and-replace rules for VS Code, Sublime Text, sed, grep or your CMS.
  • Write redirect and rewrite rules for Nginx, Apache or Cloudflare with confidence.
  • Learn regex syntax by experimenting, with an explanation attached to every token.
  • Sanity-check a pattern on your phone during a code review, away from your desk.

Regex cheat sheet

The tokens people look up most often, in one place. Everything below works in the tester above.

.Any character except a newline (unless the s flag is on)
\d \w \sDigit, word character, whitespace
\D \W \SThe negated versions of the above
[abc]Any one of a, b or c
[^abc]Any character except a, b or c
[a-z0-9]Character ranges inside a class
*Zero or more of the previous token
+One or more
?Optional, or lazy after another quantifier
{2,5}Between two and five repetitions
^ $Start and end of the string, or of a line with m
\bWord boundary
(abc)Capture group, referenced later as $1
(?:abc)Group without capturing
(?<name>abc)Named capture group
a|bAlternation: a or b
(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind
\. \/ \$Escape a character that would otherwise be special

Regex tester FAQ

Stop guessing at your patterns

Paste your expression, watch every match light up and copy working code in the language you actually ship. No sign-up, no limits, nothing leaves your browser.

Scroll to Top