New: Screen RecorderScreen + webcam, trim, save as MP4Try it now →

Add tools here by clicking the star icon.
Back to tools

Regex Tester (JavaScript)

Write a pattern, paste your text and see every match highlighted, with capture groups in a table and a replace preview. Patterns run in a background worker, so a runaway regex is stopped instead of freezing your tab.

//g
Examples:
Matches highlighted
Contact: ana@example.com, bob.smith+news@mail.co.uk Meeting on 2026-10-01 and 2026-10-15 at https://example.com/meet Colors: #fff, #3B82F6 · Server 192.168.0.12
JavaScript regex cheat sheet
.
Any character except line breaks (add s flag to include them)
\d \w \s
Digit, word character [A-Za-z0-9_], whitespace
\D \W \S
Not a digit / word character / whitespace
[abc] [^abc] [a-z]
Any of, none of, range
^ $
Start / end of input (of each line with m flag)
\b \B
Word boundary / not a word boundary
* + ?
0 or more, 1 or more, 0 or 1
{3} {2,} {2,5}
Exactly 3, 2 or more, between 2 and 5
*? +? ??
Lazy versions: match as little as possible
(abc)
Capture group, referenced as $1 in replacements
(?<name>abc)
Named group, $<name> in replacements
(?:abc)
Group without capturing
a|b
a or b
(?=x) (?!x)
Followed by x / not followed by x
(?<=x) (?<!x)
Preceded by x / not preceded by x
\1 \k<name>
Back-reference to a group
\p{L} \p{Emoji}
Unicode property (needs u flag)
\. \* \\
Escape special characters

How to use it

  1. Enter a pattern (or pick an example) and toggle flags.
  2. Paste the text to test against.
  3. Read the highlighted matches and the groups table.
  4. Tick Replace to preview a replacement with $1 or $<name>, then copy it.

Common Use Cases

  • Validating emails, dates and IDs
  • Extracting values from logs
  • Building search-and-replace patterns
  • Learning regex syntax

Frequently Asked Questions

Which regex flavor is this?▼
JavaScript (ECMAScript) RegExp, exactly as your browser runs it, with the g, i, m, s, u and y flags.
Does it support groups?▼
Yes. Numbered and named groups are listed for every match, and you can use $1 or $<name> in replacements.
What does “Pattern took too long” mean?▼
The pattern ran for over 2 seconds, usually because of catastrophic backtracking from nested quantifiers like (a+)+. The tester stops it so the page stays responsive.

Why use this tool?

  • Live highlighting and match positions
  • Numbered and named capture groups
  • Replace preview
  • Catastrophic backtracking is caught after 2 seconds

Privacy & Security

Patterns and text are processed in your browser only.

How was this tool?

Your feedback helps us make it better.

Have further opinions? Email me at hello@everythingbagel.app