//gm
Flags
Cheat sheet
.any character except newline (any character at all with the s flag)\d \w \sdigit, word character, whitespace\D \W \Sthe negation of each of the above[abc] [^abc]one of these characters / anything but thesea{2,5}between two and five of aa* a+ a?zero or more, one or more, optionala+?lazy, match as few as possible^ $start and end of the string, or of a line with the m flag\bword boundary(abc)capture group, referenced later as \1(?:abc)group without capturing(?<year>\d{4})named capture groupa|beither a or b(?=abc) (?!abc)lookahead: followed by / not followed by(?<=abc) (?<!abc)lookbehind: preceded by / not preceded by\. \$ \(escape a character that would otherwise be specialPatterns are compiled and run in your browser, no pattern or test text is uploaded.
How it works
Regex Tester : Live Match Highlighting and Capture Groups
Write a pattern, flip the flags, and watch every match light up in your test string as you type. Capture groups and named groups are broken out in a table underneath.
What this does
- Every match lights up in the test string as you type the pattern
- All six JavaScript flags as independent toggles, g, i, m, s, u, y
- Match table giving the start index of each match alongside its capture groups
- Named groups from (?<name>…) labelled by name rather than by number, read out of the pattern itself
- Compile errors rewritten in plain English: “Nothing to repeat” explains which quantifier has nothing before it
FAQ
Keep going