Regex Tester for JavaScript
Test a JavaScript regular expression in your browser and inspect each match and capture group.
What it is for?What it is for?
Type a pattern and some sample text, and the matches update as you type. Each match shows where it starts in the text and what each capture group caught. Use it to check a pattern for a form field, a log line or a search and replace before you put it in code.
JavaScript, not PCRE
This uses the regular expression engine in your browser. It is not PHP PCRE. Possessive quantifiers, recursion and the pattern delimiters PHP expects are not available here. An empty match advances one character so a pattern like a* cannot loop forever, and the result stops at 200 matches.
Flags
- The g flag is always on, so every match is listed, not just the first.
- Ignore case adds i, so A and a match each other.
- Multiline adds m, so ^ and $ match at the start and end of each line, not only of the whole text.
- Dot matches newline adds s, so the dot also matches line breaks.
Common mistakes
- Type the pattern without slashes. Writing /\d+/ searches for the slashes too.
- The u flag is not set, so Unicode property escapes such as \p{L} do not work. To match Turkish letters, list them in a class, for example [a-zA-ZçğıöşüÇĞİÖŞÜ].
- Named groups are listed by number, in the order they appear in the pattern.
- If the pattern is invalid, the browser's error message is shown instead of matches.
It stays in the browser
The pattern and the text are not sent to a server.