Skip to content
Devtoolry

Regex Tester

Test JavaScript regular expressions online with live match highlighting, capture groups and flags. Debug a pattern against your own text, right in your browser.

Runs in your browser · Nothing uploadedFree · No sign-up

Something not working, or missing a feature? Send feedback

About the Regex Tester

The Regex Tester runs JavaScript regular expressions against your text as you type, highlights every match and lists capture groups, so you can build a pattern step by step instead of guessing.

Everything runs in your browser, so your input is never uploaded to a server.

How to use the Regex Tester

  1. Type the pattern between the slashes and toggle flags: global, ignore case, multiline, dot-all and Unicode.
  2. Paste the text to search in the test string box.
  3. Read the highlighted matches and capture groups, then copy the finished pattern.

Example

Extract dates with named groups

Input

Pattern: /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/g
Text:    Released 2026-10-13, patched 2026-11-02.

Result

Match 1 at index 9:  2026-10-13  year: 2026, month: 10, day: 13
Match 2 at index 29: 2026-11-02  year: 2026, month: 11, day: 02

Without the g flag only the first date would match. Named groups appear next to each match.

Common mistakes

  • Forgetting the g flag. Without g a pattern stops after the first match. Turn it on to find every occurrence, as String.matchAll and replaceAll require.
  • Greedy quantifiers. .* takes as much as it can, so <.*> matches from the first < to the last > on the line. Use the lazy .*? or a negated class like [^>]* instead.
  • Unescaped special characters. . ? * + ( ) [ ] { } | ^ $ and \ have special meanings. To match a literal dot in a domain name, write \. not .
  • ^ and $ with several lines. By default ^ and $ match only at the start and end of the whole text. Turn on the m flag to match at each line.
  • Patterns from other languages. Python, PHP and Java patterns mostly work, but possessive quantifiers, atomic groups and a leading (?i) modifier are not JavaScript syntax. Use the i flag instead.

Works well with the Regex Tester

  • Text & Code Diff: compare the text before and after a regex replacement.
  • URL Parser: split URLs into parts without writing a pattern.
  • Case Converter: change identifier casing instead of using a replacement.

Frequently asked questions

Which regex flavour does it use?

JavaScript (ECMAScript), the same engine as browsers and Node.js. Most syntax is shared with PCRE, but some features such as possessive quantifiers are not supported.

Can a pattern freeze the page?

No. Matching runs in a background worker with a time limit, so catastrophic backtracking is stopped instead of hanging your browser.

How do I match an email address?

A practical pattern is ^[^\s@]+@[^\s@]+\.[^\s@]+$, which requires one @ and a dot in the domain. Fully RFC-compliant patterns are very long; confirm addresses by sending an email instead.

What does the u flag do?

It treats the pattern and text as Unicode code points, so emoji and other astral characters count as one character, and enables \p{…} property escapes such as \p{L} for any letter.

Guides and tutorials