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:
\ddigit,\wletter/digit/underscore,\swhitespace+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 firsti: case-insensitivem: 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.