Developer tools
JavaScript Regex Tester
Test a JavaScript pattern against text and inspect matches, positions and capture groups.
JavaScript pattern syntax. Shows the first 200 matches. Positions use UTF-16 units, not visual characters.
Your answer will appear here.
Help and method
g finds successive matches; without g only the first. i ignores case, m changes line anchors, s lets dot match line breaks, u enables Unicode-aware syntax. Empty matches advance by a code point under u, otherwise one UTF-16 unit. Unmatched groups are null. End positions are exclusive; group positions are not provided. Text is never normalized. Limits: 2,000 UTF-16 units for the pattern, 100,000 for text and 1,000,000 total for captured output. Execution stops after 3 seconds. A successful test does not establish that a pattern is secure.
MDNMethods and reliabilityWorked example
An example you can try or adapt to your own values.
- Pattern, without / delimiters
- (?<word>[A-Z]+)
- Flags (gimsu, each once)
- gi
- Test text
- Hi 42 ABC
Result
Match count: 2; Matches: Hi [0, 2), ABC [6, 9)