Python Regex Tester and Compiler
A real-time python regex tester and playground. Type your regex pattern and test string below to see the matches and groups highlighted in real-time.
search
find all
full match
Flags:
IgnoreCase
Multiline
DotAll
Verbose
Match Result:
Match Info:Click highlighted text above to see its details here.
Note: This tool uses Python's regex engine. Ensure your patterns are compatible with Python's syntax.
Regex Cheat Sheet
| pattern Character | Description |
|---|---|
\d | Matches any digit |
\D | Matches any non-digit |
\w | Matches any word character (alphanumeric + underscore) |
\W | Matches any non-word character |
\s | Matches any whitespace character |
\S | Matches any non-whitespace character |
^ | Matches the start of a line |
$ | Matches the end of a line |
. | Matches any character except newline |
* | Matches 0 or more repetitions |
+ | Matches 1 or more repetitions |
? | Matches 0 or 1 repetition |
{n} | Matches exactly n repetitions |
{n,} | Matches n or more repetitions |
{n,m} | Matches between n and m repetitions |
[abc] | Matches any character in the set (a, b, or c) |
[^abc] | Matches any character not in the set |
(abc) | Matches the exact sequence "abc" |
| | Acts as a logical OR between expressions |
\b | Matches a word boundary |
\B | Matches a non-word boundary |
(?i) | Case-insensitive matching |
(?m) | Multi-line matching, affecting ^ and $ |
(?s) | Dot matches all characters, including newline |
(?x) | Verbose mode, allowing whitespace and comments in patterns |
\ | Use to escape special characters |
() | Use parentheses for grouping and capturing |
[] | Use for character classes |