Regex Tester & Cheat Sheet

Test regex patterns live with flags and a cheat sheet. Parse emails, URLs, and logs—pattern and sample text never leave the browser.

Regular Expression

//

Matches Detail (0)

No matches found

Regex Cheatsheet

Character Classes

.Any character except newline
\dAny digit (0-9)
\wAlphanumeric character [a-zA-Z0-9_]
\sWhitespace (space, tab, newline)
\DNot a digit
\WNot a word character

Anchors

^Start of line
$End of line
\bWord boundary

Quantifiers

*0 or more times
+1 or more times
?0 or 1 time (optional)
{n}Exactly n times
{n,}At least n times
{n,m}Between n and m times

Groups & Ranges

(x)Capture group
(?:x)Non-capturing group
[abc]Any character in brackets
[^abc]Any character not in brackets
x|yEither x or y (OR)

Test regex in real time

Type a pattern and matches in the text below are highlighted instantly. The fastest way to learn regex is to test against real strings instead of guessing in your head.

A ready-to-use example

Grab just the domain from emails:

Pattern:  @([a-z0-9.-]+)
Input:    hi@toolhub.com, ask@example.org
Matches:  @toolhub.com, @example.org

Common building blocks:

  • \d digit, \w letter/digit/underscore, \s whitespace
  • + one or more, * zero or more, ? zero or one
  • ^ start of line, $ end of line, . any single char

Don't forget the flags

  • g: find all matches instead of stopping at the first
  • i: case-insensitive
  • m: apply ^ and $ per line in multi-line text

If "only the first one matches," you're almost always missing the g flag.

Your pattern and text are processed only in the browser. For a library of common patterns, see the regex tester & cheatsheet.