Skip to content
Technology

Regex Tester & Builder

Test regular expressions with live match highlighting, flag support, captured group display, and a library of common patterns.

/ /

Start typing a pattern and test string to see live results

Common Regex Patterns
Regex Quick Reference
Character Classes:
  .       Any character (except newline)
  \d      Digit [0-9]
  \w      Word char [a-zA-Z0-9_]
  \s      Whitespace
  [abc]   Any of a, b, or c
  [^abc]  Not a, b, or c

Quantifiers:
  *       0 or more
  +       1 or more
  ?       0 or 1
  {n}     Exactly n
  {n,m}   Between n and m

Anchors:
  ^       Start of string/line
  $       End of string/line
  \b      Word boundary

Groups:
  (...)   Capturing group
  (?:...) Non-capturing group
  (?=...) Positive lookahead
  (?!...) Negative lookahead

FAQ

Frequently asked questions about regular expressions

What is a regular expression (regex)?
A regex is a pattern that describes a set of strings. It's used for searching, matching, and manipulating text. For example, \d+ matches one or more digits, and [a-z]+ matches lowercase words.
What do regex flags do?
g (global) finds all matches, not just the first. i (case-insensitive) ignores case. m (multiline) makes ^ and $ match line starts/ends. s (dotAll) makes . match newlines too.
How do I match an email address?
A common pattern is [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}. Note: perfectly validating emails via regex is extremely complex — this covers 99% of valid addresses.
What are capturing groups?
Parentheses () create groups that capture matched text. In 'abc123', the pattern ([a-z]+)(\d+) captures 'abc' in group 1 and '123' in group 2. Use (?:) for non-capturing groups.
What's the difference between greedy and lazy matching?
Greedy (default) matches as much as possible: .* matches the entire string. Lazy (add ?) matches as little as possible: .*? matches the minimum. Example: <.+> vs <.+?> on '<a>text</a>'.
How do I test regex performance?
Avoid catastrophic backtracking by not nesting quantifiers (e.g., (a+)+). Test with long inputs. Use atomic groups or possessive quantifiers when available. Keep patterns simple and specific.

Related calculators