Skip to content
Expensico

Regex Tester

Test JavaScript regular expressions with live match highlighting, capture groups, flags and replace preview. Protected against runaway patterns.

Runs in your browser. Everything you enter stays on your device. Nothing is sent to a server.

How to use the Regex Tester

  1. Type your pattern (without the surrounding slashes).
  2. Tick the flags you need.
  3. Paste test text — matches are highlighted and listed with their capture groups.
  4. Optionally preview a find-and-replace.

Which regex flavour is this?

The tester uses your browser's JavaScript (ECMAScript) regular-expression engine, including named groups (?<name>…), lookbehind, Unicode property escapes \p{L} with the u flag, and the s (dotAll) flag. Results match what String.prototype.match and replace do in Node.js and browsers. Most patterns also work in Python, Java and PCRE, but details like lookbehind support and escaping can differ. Need a starting point? Browse the regex pattern library.

Protection against runaway patterns

Some patterns take exponential time on certain inputs — for example (a+)+$ on a long string of a's followed by a b. The tester runs every pattern in a background worker and stops it after 1.5 seconds, so a bad pattern can't freeze your browser. If you see the timeout, the same pattern could cause a ReDoS vulnerability in your application.

Quick reference

\d \w \sdigit, word character, whitespace
. any character except newline (unless the s flag is set)
* + ? {n,m}quantifiers; add ? for lazy (e.g. .*?)
^ $ \bstart, end, word boundary
[abc] [^abc]character class, negated class
(…) (?:…) (?<n>…)capturing, non-capturing, named group
(?=…) (?!…) (?<=…)lookahead, negative lookahead, lookbehind

Frequently asked questions

Why does ^ only match the first line?

Without the m (multiline) flag, ^ and $ match only at the very start and end of the text. Turn on Multiline to match at every line.

Where can I find ready-made patterns?

The Regex pattern library has tested patterns for emails, URLs, Indian mobile numbers, PIN codes, PAN, GSTIN and more.

Is what I enter stored or sent anywhere?

No. Calculations and processing happen in your browser. Nothing you type is sent to our servers. Some tools remember your last input in this browser's local storage for convenience; you can clear it at any time.