Regex Tester
Test a JavaScript regular expression on your own text: matches are highlighted, groups are listed with their ranges and replacement updates live. A slow pattern never freezes the page; it is stopped after 2 seconds.
- Fully offline
Loading…
Features
- Match highlighting and a group table (numbered and named)
- Flags i, m, s, u, v and y
- Replacement with $1, $<name> and $&
- Catastrophic patterns stop automatically after 2 seconds
- Quick reference with notes for non-Latin text
- Works offline
Examples
Find numbers
- Input
- \d+ on a1b22c333
- Output
- 1 · 22 · 333
Persian letters (u flag)
- Input
- \p{Script=Arabic}+ on سلام hello
- Output
- سلام
Swap two words
- Input
- (\w+) (\w+) → $2 $1
- Output
- world hello
FAQ
Why doesn't \w match Persian letters?
In JavaScript, \w and \b only know ASCII letters and digits. For Persian or Arabic letters use \p{Script=Arabic} or \p{L} with the u flag. The zero-width non-joiner (U+200C) is not part of \s either.
Quick reference
Anchors: ^, $ and \b. Classes: \d, \w, \s, [a-z] and [^…]. Quantifiers: *, +, ? and {n,m}; add ? to make them lazy. Groups: (…), (?<name>…) and (?:…). Lookaround: (?=…), (?!…), (?<=…) and (?<!…).
Why do results differ from Python or PCRE?
This tool runs JavaScript's own RegExp engine. Features such as atomic groups or possessive quantifiers do not exist in JavaScript and some classes behave differently.
Is my text uploaded?
No. The pattern and text run only on your device, inside a browser Worker.