Regular Expression Tester

Regular Expression
/ /
Test content
Explanation

Enter a regex pattern and test content to see results

Match Details 0

Click on a match to see details

Regex Quick Reference
Character Classes
  • . - Any character except newline
  • \d - Any digit (0-9)
  • \w - Any word character (a-z, A-Z, 0-9, _)
  • \s - Any whitespace character
  • [abc] - Any character a, b, or c
  • [^abc] - Any character except a, b, or c
  • [a-z] - Any lowercase letter
Quantifiers
  • * - 0 or more
  • + - 1 or more
  • ? - 0 or 1
  • {3} - Exactly 3
  • {3,} - 3 or more
  • {3,5} - Between 3 and 5
Anchors
  • ^ - Start of string/line
  • $ - End of string/line
  • \b - Word boundary
  • \B - Not word boundary
Examples

Testing Regular Expressions Before They Bite

Write a pattern, paste sample text, and every match is highlighted with its capture groups and positions as you type. The tester runs JavaScript's RegExp engine, so behaviour matches exactly what you will get in Node.js or the browser - including the occasionally surprising interaction of flags like g, m and u.

Test with input that should not match, not only input that should - most regex bugs in production are over-matching, not under-matching. For a working vocabulary of character classes, anchors, lookarounds and the classic catastrophic-backtracking trap, see the regex guide.

Regex Questions

Pattern matching in text. Validating emails, extracting data, find-and-replace with conditions, parsing logs - anything where "find this exact pattern" is needed.

. = any char. * = zero or more. + = one or more. ? = optional. ^/$ = start/end. \d = digit. \w = word char. [abc] = any of a, b, c. There's more, but that covers 80% of use cases.

Add the 'i' flag. In JavaScript that's /pattern/i. This tool has a checkbox for it.

Probably forgot to escape a special character (. matches ANYTHING, not a literal dot), or your pattern is greedy when it should be lazy (.*? vs .*). The live preview here helps you debug.