๐Ÿ” Regex Tester

Free online regex tester. Real-time test and debug JavaScript regular expressions with g/i/m/s/u/y flags, highlighted matches, capture groups, match positions, and replace preview. Essential tool for developers. | No sign-up ยท Data never leaves your browser

Zero dependencies ยท Works offline

๐Ÿงช Regex Test

Quick patterns: \d{3}-\d{4} Email Phone URL Date
Flags:

๐Ÿ“Š Match Results

Matches: 0
Regex: /\d{3}-\d{4}/g

๐Ÿ“– Regex Cheat Sheet

SymbolMeaningExampleMatches
.Any char (except newline)a.cabc, a1c
\dDigit [0-9]\d+123, 4567
\wWord char [a-zA-Z0-9_]\w+hello_world
\sWhitespacea\s+ba b, a b
\bWord boundary\bcat\bcat (not catch)
^Start of line^HelloHello at start
$End of lineworld$world at end
*0 or moreab*cac, abc, abbc
+1 or moreab+cabc, abbc
?0 or 1ab?cac, abc
{n}Exactly n\d{4}2024
( )Capture group(\d+)-(\d+)123-456, $1=123
[abc]Character class[aeiou]Any vowel
[^abc]Negated class[^0-9]Non-digit
|Alternationcat|dogcat or dog

How to Use Regex Tester

  1. Enter Regex
    Type your regular expression in the input field (without surrounding slashes). Use quick patterns for common regex.
  2. Select Flags
    Toggle flags: g (global), i (ignore case), m (multiline), s (dotAll), u (unicode), y (sticky).
  3. Enter Test Text
    Paste or type the text to test against. Matches are highlighted in real-time.
  4. View Match Details
    See each match position, capture groups, and replace preview.

โ“ FAQ

What do regex flags g, i, m mean?

g (global) finds all matches instead of stopping at the first. i (ignoreCase) ignores case. m (multiline) makes ^ and $ match start/end of each line. s (dotAll) makes . match newlines too. u (unicode) enables Unicode support. y (sticky) matches from lastIndex position.

What are capture groups?

Capture groups use parentheses () to extract matched substrings. For example, regex (\d{4})-(\d{2})-(\d{2}) matching '2024-01-15' yields group 1='2024', group 2='01', group 3='15'. Use $1, $2 in replacements.

Why isn't my regex matching?

Check that special characters are properly escaped (e.g., \d for digits), flags are correct (e.g., need g flag for multiple matches), and the regex syntax is valid. This tool shows real-time error messages to help debug.