All tools
Regex tester
Test a regular expression against text, see every match and group, and preview a replacement.
Use $1 for a group, $<name> for a named group, $& for the whole match.
Quick reference
- .
- Any character except a line break (any at all with s)
- \d \w \s
- Digit, word character, whitespace. \D \W \S match the opposite
- [abc] [^abc] [a-z]
- One of, none of, a range
- ^ $
- Start and end of the text, or of each line with m
- \b
- Word boundary
- * + ? {2,5}
- Repeat 0+, 1+, 0 or 1, 2 to 5 times. Add ? to match as few as possible
- (abc) (?<name>abc)
- Capture group, named group
- (?:abc)
- Group without capturing
- a|b
- Either
- (?=a) (?!a)
- Followed by, not followed by
- (?<=a) (?<!a)
- Preceded by, not preceded by
- \1 \k<name>
- The same text a group matched
- \p{L}
- Any letter (needs u or v)