Answer

How to test a regular expression

Test and debug regular expressions against sample text in your browser, with live match highlighting.

A regex tester runs your pattern against sample text and highlights the matches and capture groups live, so you can refine it without writing code. For example, the pattern \b\d{3}-\d{4}\b matches "555-1234" in "Call 555-1234".

Input
pattern: \b\d{3}-\d{4}\b   ·   text: Call 555-1234
Output
match: 555-1234

\d is a digit, {3} and {4} are counts, \b is a word boundary.

Open the Regex Tester → Free · runs in your browser · nothing uploaded

Steps

  1. Open the Regex tool and type your pattern (and any flags like g, i, m).
  2. Paste the sample text to test against.
  3. See matches highlighted live, along with any capture groups.
  4. Tweak the pattern until only the intended text matches.

Frequently asked questions

What do the regex flags g, i, and m mean?
g (global) finds all matches rather than just the first; i (ignore-case) makes it case-insensitive; m (multiline) makes ^ and $ match at line breaks rather than only the start/end of the whole string.