Regular expressions are patterns used to match character combinations in strings. This tool helps you:

  • Test regex patterns against sample text
  • Debug complex expressions with highlighted matches
  • Generate common patterns for emails, URLs, dates, etc.
  • Learn with our comprehensive regex cheatsheet

Results

No results yet. Enter a regex pattern and test text, then click "Test Regex".

Regex Cheatsheet

Quick reference for common regex patterns and syntax:

Pattern Description Example
\d Digit (0-9) \d{3} matches "123"
\w Word character (a-z, A-Z, 0-9, _) \w+ matches "hello"
\s Whitespace (space, tab, newline) \s matches " "
. Any character except newline a.c matches "abc"
^ Start of string/line ^Start matches start of line
$ End of string/line end$ matches end of line
[abc] Any of a, b, or c [aeiou] matches vowels
[^abc] Not a, b, or c [^0-9] matches non-digits
* 0 or more repetitions a* matches "", "a", "aa", etc.
+ 1 or more repetitions \d+ matches "1", "123", etc.
? 0 or 1 repetition colou?r matches "color" or "colour"
{n} Exactly n repetitions \d{3} matches "123"
{n,} n or more repetitions \d{2,} matches "12", "123", etc.
{n,m} Between n and m repetitions \d{2,4} matches "12", "123", "1234"
(...) Capture group (abc) captures "abc"
(a|b) a or b (cat|dog) matches "cat" or "dog"
\b Word boundary \bword\b matches whole word
\B Not word boundary \Bword\B matches inside words