How to use
- 1Enter your pattern and set flags (g, i, m, s, u, y).
- 2Paste the test text; matches highlight as you type.
- 3Inspect each match with its numbered and named groups.
- 4Try a replacement with $1 or $<name> to preview the result.
JavaScript regex flags
g finds all matches instead of stopping at the first. i ignores case. m makes ^ and $ match at line starts and ends instead of only the whole string. s lets . match newlines too. u enables full Unicode mode, needed for emoji and \p{L}-style property escapes. y (sticky) matches only at the exact current position. The tester uses your browser’s JavaScript engine, so results match exactly what your JS or TypeScript code will do.
Groups and replacements
Parentheses ( ) capture a group you can reference as $1, $2 in replacements; (?<year>\d{4}) creates a named group referenced as $<year>; (?: ) groups without capturing. Example: pattern (\d{4})-(\d{2})-(\d{2}) with replacement $3/$2/$1 turns 2026-10-06 into 06/10/2026. The replace preview shows the result before you put it into code.
Avoiding regex pitfalls
Escape special characters (. * + ? ^ $ { } ( ) | [ ] \) when you mean them literally — an unescaped dot matches any character. Prefer lazy quantifiers (.*?) when matching between delimiters. Watch out for nested quantifiers like (a+)+, which can cause catastrophic backtracking and freeze on long input. For emails and URLs, a pragmatic pattern from the cheat sheet beats trying to implement the full RFC.
Frequently asked questions
Which regex flavor does this use?
JavaScript (ECMAScript) regex, as implemented in your browser. Most syntax also works in PCRE, Python and Java, but lookbehind, named group syntax and some escapes differ.
Why does my pattern only find one match?
Add the g (global) flag to find all matches.
How do I match across multiple lines?
Use the s flag so . matches newlines, or the m flag if you need ^ and $ to match at each line.
Is there a regex for email validation?
The cheat sheet includes a practical email pattern, along with URL, phone number and IBAN patterns. The only full proof an email works is sending a confirmation message.
Not happy with the results?
Talk to Webin Agency about fast, SEO-friendly websites, e-commerce and Google Ads management.