How to use it
- Type a pattern in “Regular expression”. Leave out the surrounding slashes.
- Tick the flags you need (
gis on by default). - Enter text under “Test string”. Matches are highlighted, and the list below shows each match’s position and capture groups.
- Tick “Replace” to preview the result of a replacement.
The tester uses your browser’s JavaScript (ECMAScript) regex engine. Some syntax differs from PCRE, Python or .NET.
Flags
| Flag | Meaning |
|---|---|
g | Find all matches, not just the first |
i | Ignore case |
m | ^ and $ match at the start and end of each line |
s | . also matches line breaks |
u | Unicode mode: emoji count as one character and \p{...} works |
y | Sticky: match only from where the last match ended |
Common building blocks
| Syntax | Meaning |
|---|---|
\d, \w, \s | Digit, word character, whitespace |
[a-z], [^a-z] | Character in, or not in, a range |
*, +, ?, {2,4} | Repeat 0+, 1+, 0–1, or 2–4 times |
(...) | Capture group, referenced as $1 in replacements |
(?<name>...) | Named group, referenced as $<name> |
(?=...), (?<=...) | Lookahead and lookbehind |
\p{L} | Any letter in any script (needs u) |
Safe with heavy patterns
Patterns such as (a+)+$ can take minutes on some inputs because of catastrophic backtracking. This tester runs the regex in a separate thread (a Web Worker) and stops it after 1.5 seconds, so your browser never freezes.
Frequently asked questions
Is my text uploaded?
No. The regex runs entirely in your browser.
Are the example patterns complete validators?
No. They are simplified starting points. Real email address syntax, for example, is far more complex. Adjust them for your use.