Regex Tester
Test JavaScript regular expressions online with live match highlighting, capture groups and flags. Debug a pattern against your own text, right in your browser.
Runs in your browser · Nothing uploadedFree · No sign-up
Something not working, or missing a feature? Send feedback
About the Regex Tester
The Regex Tester runs JavaScript regular expressions against your text as you type, highlights every match and lists capture groups, so you can build a pattern step by step instead of guessing.
Everything runs in your browser, so your input is never uploaded to a server.
How to use the Regex Tester
- Type the pattern between the slashes and toggle flags: global, ignore case, multiline, dot-all and Unicode.
- Paste the text to search in the test string box.
- Read the highlighted matches and capture groups, then copy the finished pattern.
Example
Input
Pattern: /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/g
Text: Released 2026-10-13, patched 2026-11-02.Result
Match 1 at index 9: 2026-10-13 year: 2026, month: 10, day: 13 Match 2 at index 29: 2026-11-02 year: 2026, month: 11, day: 02
Without the g flag only the first date would match. Named groups appear next to each match.
Common mistakes
- Forgetting the g flag. Without g a pattern stops after the first match. Turn it on to find every occurrence, as String.matchAll and replaceAll require.
- Greedy quantifiers. .* takes as much as it can, so <.*> matches from the first < to the last > on the line. Use the lazy .*? or a negated class like [^>]* instead.
- Unescaped special characters. . ? * + ( ) [ ] { } | ^ $ and \ have special meanings. To match a literal dot in a domain name, write \. not .
- ^ and $ with several lines. By default ^ and $ match only at the start and end of the whole text. Turn on the m flag to match at each line.
- Patterns from other languages. Python, PHP and Java patterns mostly work, but possessive quantifiers, atomic groups and a leading (?i) modifier are not JavaScript syntax. Use the i flag instead.
Works well with the Regex Tester
- Text & Code Diff: compare the text before and after a regex replacement.
- URL Parser: split URLs into parts without writing a pattern.
- Case Converter: change identifier casing instead of using a replacement.
Frequently asked questions
Which regex flavour does it use?
JavaScript (ECMAScript), the same engine as browsers and Node.js. Most syntax is shared with PCRE, but some features such as possessive quantifiers are not supported.
Can a pattern freeze the page?
No. Matching runs in a background worker with a time limit, so catastrophic backtracking is stopped instead of hanging your browser.
How do I match an email address?
A practical pattern is ^[^\s@]+@[^\s@]+\.[^\s@]+$, which requires one @ and a dot in the domain. Fully RFC-compliant patterns are very long; confirm addresses by sending an email instead.
What does the u flag do?
It treats the pattern and text as Unicode code points, so emoji and other astral characters count as one character, and enables \p{…} property escapes such as \p{L} for any letter.
Guides and tutorials
Related tools
JSON Validator
Validate JSON online and find syntax errors such as trailing commas or single quotes by exact line and column. Valid documents get a structure summary.
JSON Schema Validator
Validate JSON against a JSON Schema online. Every error shows the failing path, line and rule; drafts 2020-12, 2019-09, 7 and 4 are supported.
XML Validator
Validate XML online and check that it is well-formed. Syntax errors are reported with their exact line and column, so broken tags are easy to find.
YAML Validator
Validate YAML syntax online, find errors by line, and see the parsed result as JSON. Check Kubernetes, Docker Compose and CI files before you deploy.
JSON Formatter
Format and beautify JSON with configurable indentation and optional key sorting. Errors are reported with exact line and column.
HTML Formatter
Format and beautify messy or minified HTML into clean, indented markup with Prettier, including embedded CSS and JavaScript. Runs locally in your browser.