Test a regular expression against your text, with matches highlighted, capture groups listed and a find-and-replace preview.
Loading the tool…
Regex quick reference
| Pattern | Matches |
|---|---|
| . | Any character except a line break |
| \d \w \s | A digit, a word character, whitespace |
| [abc] [^abc] | One of a, b or c; anything except them |
| * + ? {2,4} | 0 or more, 1 or more, optional, 2 to 4 times |
| ^ $ | Start and end of the text (or line with m) |
| ( ) (?: ) | Capture group, non-capturing group |
| (?<name> ) | Named group |
| a|b | a or b |
Flags
| Flag | Meaning |
|---|---|
| g | Find all matches, not just the first |
| i | Ignore case |
| m | ^ and $ match at line breaks |
| s | Dot also matches line breaks |
| u | Full Unicode support |
Each test runs in a background worker. If a pattern takes more than two seconds, usually because of catastrophic backtracking like (a+)+, it’s stopped instead of freezing your browser.
Frequently asked questions
Which regex flavour does this use?
JavaScript. Most patterns work the same in Python, PHP and Java, but check advanced features.
How do I use capture groups in the replacement?
Use $1, $2 and so on, or $<name> for named groups.
Why does my pattern only find one match?
Add the g flag.
Is my text uploaded?
No, it’s tested in your browser.
Sources
Last updated: