Text Utilities
Regex Tester
Test JavaScript regular expressions with live matches.
Matches
0 matchesMatch details
Frequently Asked Questions & Guide
How to use this Regex Tester
- Enter your regular expression in the pattern input (without the surrounding slashes — those are added for you).
- Type the flags (
g,i,m,s,u,y) in the flags box, or tick the checkboxes below. - Paste the text you want to test against into the Test string box on the left.
- Matches are highlighted in the right-hand panel, with a list of each match, its position, and capture groups.
This tester uses the browser's native RegExp implementation, which is the exact same engine that will run your regex in production JavaScript code. This means: if it works here, it works in your app. There is no subtle difference between the test environment and production — both use V8's regex engine (in Chrome, Edge, Node.js), SpiderMonkey (in Firefox), or JavaScriptCore (in Safari).
What is a Regular Expression?
A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. Originally formalized by the mathematician Stephen Cole Kleene in the 1950s and incorporated into Unix text tools (grep, sed, awk) in the 1970s, regexes are now ubiquitous in programming. They are used for input validation (email addresses, phone numbers, postal codes), search and replace in text editors, log parsing, URL routing, syntax highlighting, and many other tasks.
JavaScript's regex syntax is based on Perl 5's regex syntax and is documented in ECMAScript specification. Common constructs include:
.— any character (except newline, unlesssflag is set)\d,\w,\s— digit, word character, whitespace[abc],[^abc],[a-z]— character classes*,+,?,{n,m}— quantifiers^,$— anchors (start and end of string, or line withmflag)(),(?:),(?=),(?!)— groups and lookarounds|— alternation (OR)
Which flags should I use?
- g (global) — find all matches, not just the first. Almost always what you want when testing.
- i (case-insensitive) — treat
A-Zanda-zas equivalent. - m (multiline) — make
^and$match at line breaks, not just string boundaries. - s (dotall) — make
.match newlines too. - u (unicode) — treat the pattern as a sequence of Unicode code points. Required for emoji, astral-plane characters, and Unicode property escapes (
\p{L}). - y (sticky) — match only at the current
lastIndexposition. Rare in practice.
Why does my regex work on regex101.com but not here?
regex101.com defaults to the PCRE2 flavor (used by PHP, Rust, Go's regexp). JavaScript's regex flavor is slightly different: it doesn't support possessive quantifiers (*+, ++), atomic groups ((?>)), or named backreferences with \k<name> in older browsers. This tester uses the JavaScript flavor, which matches what your code will actually run.
Is my regex or text sent to a server?
No. The native RegExp engine runs in your browser. Your pattern and test string never leave your device.