What this tool does
Enter a regular expression, choose flags, and provide text to see the matches. A test stops after about 750 milliseconds if it takes too long. Simplify the expression or shorten the text and try again.
- Supports six JavaScript flags: g, i, m, s, u, y.
- The results list the matching text, starting index, numbered capture group, and named capture group.
- Highlighting is constructed from text nodes and mark elements, without splicing user HTML.
How to use it
- Enter Pattern without the / on both sides.
- Select the required flags.
- Matches are highlighted, and HTML in the test text is not executed.
- View match count, index, capturing groups, and highlighting.
Common uses
- Debug logs, filename and form validation modes.
- Compare global and non-global matching behavior.
- Observe the capture groups and case, multiline, dotAll options.
Regex Tester Features
Test regular expression flags and inspect match positions and capture groups. Tests that take too long stop automatically. Review the result, then copy it for use.
FAQ
Why doesn't Pattern write /.../?
The input box only receives the expression body, and flags has an independent checkbox to avoid confusion between slashes and slashes in the content.
What is catastrophic backtracking?
Some expressions take a long time with certain text, especially when quantifiers are nested. If a test times out, reduce repeated matching, simplify the expression, or test shorter sections of text.
How many matches will be displayed if g is not checked?
According to JavaScript regular semantics, only the first match is returned; after g is checked, all matches will continue to be enumerated.