Regex Tester
This regex tester runs a JavaScript regular expression against sample text and lists matches and capture groups.
How to use
- Enter a pattern without slashes, or paste a /pattern/flags literal if the field accepts it.
- Set flags such as g, i, m, s, or u.
- Paste the sample text and read highlighted matches. The pattern stays in your browser.
How it works
The page compiles the pattern with the browser’s RegExp engine (ECMAScript), not PCRE or .NET. Global (g) finds every match. Invalid syntax shows the engine’s error instead of a match list.
Example. The pattern \d+ with the g flag on “Order 12 and 4” matches 12 and 4. A missing parenthesis is reported as a syntax error.
Frequently asked questions
Which regex flavor is this?
JavaScript (ECMAScript) via your browser's RegExp. It is not PCRE, Python, or .NET.
Are my strings uploaded?
No. Matching runs locally. The pattern and sample text stay in your browser.
What flags can I use?
Common JS flags: g, i, m, s, u, y. Global finds every match, i ignores case, m lets ^ and $ match line edges, s lets a dot match a newline, u turns on Unicode mode, and y (sticky) matches only at the current index.
Why did my pattern error?
Invalid syntax throws a browser RegExp error. Check unescaped slashes or unfinished groups. The message in Matches is the engine error itself.
Can I replace matches?
This version tests and lists matches. Substitution can be added later.
Related tools
- DevJSON Formatterin-browser JSON pretty-printer, minifier, and syntax validator.
- DevBarcode GeneratorEncode a SKU or number as Code 128, Code 39, EAN-13, or UPC-A and download PNG or SVG.
- DevUPC GeneratorBuild a valid UPC-A barcode digit string with check digit.
- DevSubnet CalculatorCIDR to netmask, hosts, network, and broadcast for IPv4.
- DevXML FormatterPaste XML to pretty-print, validate, and minify it in the browser.
- DevSQL FormatterBeautify messy SQL queries with clean indentation and uppercase keywords.