Quick access

Regex Tester

Test, debug, and visualize regular expressions in real-time.

Error:

Pattern
Test String
Matches:
Results
Matches: Groups: Pattern: chars

Regex Cheat Sheet

Character Classes

  • . Any character
  • \d Digit [0-9]
  • \w Word char
  • \s Whitespace
  • [abc] a, b, or c
  • [^abc] Not a, b, c

Anchors

  • ^ Start of string
  • $ End of string
  • \b Word boundary
  • \B Not word boundary

Quantifiers

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

Groups

  • (abc) Capture group
  • (?:abc) Non-capture
  • (?=abc) Lookahead
  • (?!abc) Neg lookahead
  • (?<=abc) Lookbehind
  • (?<!abc) Neg lookbehind

About the Regex Tester

A regular expression (regex) is a pattern for finding text, such as \d{3}-\d{4} for a phone-number fragment. The tester highlights every match as you type.

How to use it

  1. 1 Type your regex pattern and choose flags.
  2. 2 Paste the text to test against.
  3. 3 Check the highlighted matches and capture groups.

Frequently asked questions

Which regex flavour is used?

JavaScript regular expressions, as used in browsers and Node.js. Most syntax is the same in PHP (PCRE) and Python.

What do the g, i, and m flags do?

g finds all matches instead of just the first, i ignores case, and m makes ^ and $ match at the start and end of each line.

How do I match a literal dot?

Escape it with a backslash: \. On its own, a dot matches any character.