Test JavaScript regex patterns the same way they'll run in your code - using the browser's actual RegExp engine. Supports the g, i, m, s, u and y flags, named capture groups, lookbehind assertions, and Unicode property escapes. Paste your pattern, paste your test string, see live matches.
When to use this
Use when: writing regex for React / Node.js / Express / Next.js code, validating form inputs in JavaScript, parsing API responses with non-trivial string patterns, building search-and-replace logic, debugging existing regex that 'sometimes works'.
Frequently Asked Questions
Is JS regex the same as PCRE / Python regex?
Mostly but not exactly. JS regex is based on the ECMAScript spec. PCRE (Perl-compatible) and Python's re module support extra features like recursive patterns, atomic groups, and possessive quantifiers that JS lacks. If you copy a regex from a Python or PHP example, double-check it works in JS first.
What's the 's' flag and when do I need it?
's' (dotAll) makes `.` match newlines. Without 's', `.` matches everything except `\n`. Added in ES2018. Use when your input is multi-line and you want to match across lines (e.g. extracting blocks of text spanning newlines).
Powered by Regex Tester.