Regex Tester
Test a JavaScript regular expression against text and inspect match positions and capture groups. This shows what a pattern actually selects without assuming equivalence with every other regex engine.
- Runs in your browser
- Nothing is uploaded
- No signup; device limits apply
Loading the tool. If it does not appear, reload this page.
How to use this tool
Provide the pattern, sample text and required flags such as global or case-insensitive matching. Keep flags separate from the pattern body and start with a small example whose expected matches are clear.
Results and examples
Pattern a with the g flag finds three a characters in banana. Without global matching, only the first match is handled, so different counts can simply reflect the chosen flags.
Limitations
- Heavy backtracking on long strings can make the page unresponsive.
- JavaScript syntax and UTF-16 offsets differ from engines such as PCRE.
Fields
| Field | Guidance and constraints |
|---|---|
| Pattern | Check the unit and format displayed beside this field. |
| Flags | Check the unit and format displayed beside this field. |
| g (global) | Check the unit and format displayed beside this field. |
| i (ignore case) | Check the unit and format displayed beside this field. |
| m (multiline) | Check the unit and format displayed beside this field. |
| s (dotAll) | Check the unit and format displayed beside this field. |
| u (Unicode) | Check the unit and format displayed beside this field. |
| Test string | Check the unit and format displayed beside this field. |
| Highlight | Check the unit and format displayed beside this field. |
| Match list / groups | Check the unit and format displayed beside this field. |
Data handling
Processing stays in the current browser tab; the site does not upload tool input for the calculation itself.
Sources
Frequently asked questions
How do I find every a in banana?
Pattern a with the g flag finds three a characters in banana. Without global matching, only the first match is handled, so different counts can simply reflect the chosen flags.
Will another language behave identically?
Heavy backtracking on long strings can make the page unresponsive. JavaScript syntax and UTF-16 offsets differ from engines such as PCRE.