Regex Tester & Live Matcher

Paste a pattern and a test string. Matches highlight as you type, capture groups are listed, and replace supports $1 and $<name>.

Regex in one line: a regular expression matches text by rule, not by literal string. JavaScript’s RegExp engine runs in your browser, so nothing you paste is uploaded.

✅ Quick Answer

\d+ matches 123 in "abc 123". ^user_\w+$ matches a whole line. (?<year>\d{4}) names a capture group.

Rule of thumb: g finds all matches, i ignores case, m makes ^/$ per line, s lets . match newlines, u enables Unicode properties. A 2-second Worker timeout protects against catastrophic backtracking.

Try an example:
# Match Index Groups
0matches
0groups
—elapsed (ms)
gflags

Frequently Asked Questions

Does this regex tester upload my text?

No. Matching and replacing run entirely in your browser with JavaScript’s RegExp engine. Nothing you paste is sent to a server.

Which flags are supported?

g, i, m, s, u and y — the flags available in modern JavaScript engines.

Does it support named capture groups?

Yes. Write (?<name>...) and reference it in the replacement as $<name>. The match table lists both numbered and named groups.

Why did my replacement not change anything?

Three common causes: the g flag is not ticked (only the first match is replaced), the pattern has no capture group so $1 is empty, or $ is escaped incorrectly. Use $$ for a literal dollar sign.

Why does my pattern hang the page?

That is catastrophic backtracking — a pattern like (a+)+$ can take exponential time on the wrong input. This tool runs the regex in a Web Worker and terminates it after 2 seconds, so the page stays responsive.

Can it match Chinese, Japanese or emoji?

Yes. Tick the u flag and use Unicode property escapes such as \p{Script=Han} for Chinese, \p{Script=Hiragana} for Japanese, or \p{Extended_Pictographic} for emoji.

Are lookahead and lookbehind supported?

Yes. (?=...), (?!...), (?<=...) and (?<!...) all work in current browsers.

Can I share a regex and its test string?

Click Copy Share Link — the URL includes the pattern, flags and test string as query parameters, so the recipient sees exactly what you saw.

Is there a size limit on the test string?

Yes, 1 MB per run. The match list is capped at 10,000 entries, and a run that takes longer than 2 seconds is terminated.

Regex Tester — Test Regular Expressions Online, Safely and Instantly

Regular expressions are used every day for form validation, log filtering, bulk find-and-replace, URL routing and scraping. This tester shows exactly what a pattern matches, which groups it captures, and what a replacement produces — without uploading anything.

Why use our Regex Tester?

  • Live highlighting as you type, with a 300 ms debounce.
  • Numbered and named capture groups listed side by side.
  • Replace with $1, $&, $<name> and $$.
  • 2-second Worker timeout against catastrophic backtracking.
  • 100% local — no upload, no signup, no usage limits.

Regex quick reference

Token Meaning Example
.Any character except newlinea.c → abc
\dDigit\d{4} → 2026
\wWord character\w+
\sWhitespace\s+
+ * ?Quantifiersa+, a*, a?
{n,m}Quantifier range\d{2,4}
^ $Line anchors^abc$
\bWord boundary\bcat\b
( ) (?: )Capturing / non-capturing group(ab)+
(?<name> )Named group(?<y>\d{4})
(?= ) (?<= )Lookahead / lookbehind\d(?=px)
\p{...}Unicode property (needs u)\p{Script=Han}

Whether you are validating an email field, extracting timestamps from a log or writing a scraper, this tester gives you an immediate answer without leaving the browser.

Working with encoded data? Pair this tool with the JSON Formatter for API payloads, the Base64 Encoder for decoding tokens, and the URL Encoder when a pattern has to survive a query string.

Edge cases worth checking: the g flag keeps lastIndex between runs, so repeated tests can alternate between match and no match. . does not cover newlines unless s is set, and greedy quantifiers may swallow more than intended.

A 60-second reproducibility check: test [0-9]{3}-[0-9]{4} against 123-4567 — one match. Add g to see all matches, then try m with ^ and $ on two lines.

Troubleshooting: nested quantifiers like (a+)+ can freeze a tab through catastrophic backtracking — shorten the input first. If nothing matches, check escaping for literal dots and slashes and whether the right flags are enabled.