Regex workbench
JavaScript regular expressions · Runs locally in your browser
Examples:
Match preview
Testing…
Testing pattern…
Match details
Match details will appear here.
Positions are zero-based UTF-16 offsets; the end position is exclusive. │ indicates a zero-length match.
Use $& for the full match, $1 for a numbered group, $<name> for a named group, and $$ for a literal dollar sign. Enable g to replace all matches.
Replacement result will appear here.
Regex quick reference
- \d / \w / \s
- Digit / word character / whitespace
- . / [abc] / [^abc]
- Any character / character set / negated set
- * / + / ? / {n,m}
- Zero or more / one or more / optional / repetition range
- ^ / $ / \b
- Start / end / word boundary
- (abc) / (?:abc)
- Capture group / non-capturing group
- (?<name>abc) / (?=abc)
- Named capture / positive lookahead
How to use the Regex Tester
- Enter a JavaScript regular expression without enclosing slashes and choose flags.
- Paste sample text or load an example, then inspect highlighted matches and expand capture group details.
- Try a replacement using $1 or $<name>, then copy the output or export matches as JSON.
Example:
^\\d{4}-$Regex Tester FAQ
Why should I test more than one sample?
A pattern can match one example while missing edge cases, so test valid, invalid, and boundary inputs before shipping it.
Which regex engine does this tool use?
It uses your browser's JavaScript RegExp engine. Syntax may differ from Python, PHP, Java, or other regex engines.
What happens if a pattern takes too long?
Matching runs in a separate worker with a timeout to keep the page responsive. Results are limited to 1,000 matches.