How to use the regex tester
Enter a pattern without the surrounding slashes, tick the flags you need and type or paste the text to test. Matches are highlighted in alternating colours as you type, so adjacent matches stay distinguishable. Below you will find a table of every match with its position and capture groups, including named groups such as (?<year>\d{4}).
The flags work exactly as in JavaScript: g finds all matches, i ignores case, m lets ^ and $ match at line breaks, s lets the dot match newlines, u enables full Unicode and y anchors at the last index. The What the pattern means panel breaks the expression into pieces and describes each one, which is a good way to learn or to review someone else's regex. The Replace box previews String.replace output with $1, $<name> and $&.
Because the tester uses your browser's own regular expression engine, a pattern that works here behaves identically in your JavaScript code.
Worked example
Pattern (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) with the g flag on the text Released 2024-03-15, patched 2024-04-02. finds two matches:
#1 2024-03-15 at 9-19 year=2024 month=03 day=15
#2 2024-04-02 at 29-39 year=2024 month=04 day=02
With the replacement $<day>/$<month>/$<year> the text becomes Released 15/03/2024, patched 02/04/2024.
Avoiding slow patterns
Some patterns take exponential time on certain inputs, a problem called catastrophic backtracking. Nested quantifiers such as (a+)+$ are the classic cause. To keep your browser responsive, every test runs in a background worker with a time limit of a few seconds; if it is exceeded you get a warning instead of a frozen tab. Make quantifiers specific, prefer [^"]* over .* inside delimiters, and anchor patterns where you can. Never run untrusted patterns on a server without a timeout.
Frequently asked questions
Which regex flavour does the tester use?
The JavaScript (ECMAScript) flavour of your own browser, including lookbehind, named groups and Unicode property escapes in current browsers. Other languages differ in small ways such as possessive quantifiers and inline flags.
Why does my pattern work in Python or PCRE but not here?
Features like atomic groups, possessive quantifiers, recursion and inline modifiers such as (?i) are not part of JavaScript. Use the flags box for case-insensitivity and rewrite the rest with lookaheads.
What does the timeout warning mean?
The pattern took too long on your text, which usually means catastrophic backtracking. Simplify nested quantifiers or make the pattern more specific.
Can I share a regex with a colleague?
Yes. Copy share link stores the pattern, flags, text and replacement in the URL fragment. Do not include private text in a shared link.