Regular Expression Tester
Test JavaScript regular expressions, inspect numbered and named capture groups, and preview text replacements.
Regular expression
Invalid pattern
Enter a regular expression pattern.
Test text
Matches
Enter a regular expression
Match results and capture groups will appear here.
Pattern matching
Build and verify regular expressions against real text
Regular expressions can locate, validate, extract, and transform structured text, but complicated patterns should be tested carefully before production use.
Extract structured values
Capture groups can isolate parts of a match such as protocols, hostnames, identifiers, dates, and application-specific fields.
Avoid catastrophic backtracking
Nested quantifiers and ambiguous alternatives can make some expressions extremely slow. Keep patterns specific and test them with unexpected or adversarial input.
Guide
About JavaScript Regular Expression Tester
Regular expressions locate, validate, extract, and transform patterned text.
This tester uses the browser's JavaScript RegExp engine and displays matches, capture groups, and replacement previews.
Complex patterns should be tested against unexpected input because excessive backtracking can cause serious performance problems.
JavaScript regex features
Behavior follows the RegExp implementation in your browser.
- Global and case-insensitive flags
- Multiline and dotAll modes
- Unicode handling
- Named capture groups
- Replacement previews
Capture groups
Groups isolate parts of a match for extraction or replacement using numbered or named references.
Common pattern mistakes
Escaping, anchors, greediness, flag selection, and character classes often cause unexpected matches.
Performance safety
Avoid ambiguous nested quantifiers and test untrusted patterns against bounded input to reduce denial-of-service risk.
FAQ
Frequently asked questions
Which regex syntax is used?
The browser's JavaScript or ECMAScript RegExp syntax.
What does the g flag do?
It searches for all non-overlapping matches instead of stopping after the first.
How do I reference capture groups in replacements?
Use $1, $2, and similar references, or $<name> for named groups.
Why does my regex match too much?
A greedy quantifier may need to be made more specific or lazy.
What is catastrophic backtracking?
It is extremely expensive regex evaluation caused by ambiguous pattern paths.
Is test text uploaded?
Evaluation is intended to occur locally in your browser.
Continue exploring
Related tools
Useful tools for the next step in the same workflow.
JSON Formatter
Format, minify, and validate JSON safely in the browser.
Encoding & Data
URL Encoder/Decoder
Encode, decode, and inspect URL values locally.
Encoding & Data
HTTP Header Analyzer
Analyze pasted response headers for common browser security controls.
Website Security
CSP Builder
Build and review Content Security Policy headers.
Website Security
Base64 Encode / Decode
Encode and decode Base64 data directly in your browser.
Encoding & Data
UUID Generator & Validator
Generate and validate UUID values locally.
Encoding & Data