Regex Tester

Test regular expressions with live match highlighting, capture groups and replace preview.

//

        

Match details


        
Cheat sheet
.
any character except newline
\d \w \s
digit, word character, whitespace (\D \W \S = not)
[abc] [^abc] [a-z]
any of, none of, range
^ $ \b
start, end, word boundary
* + ? {2,5}
0+, 1+, 0 or 1, between 2 and 5 (add ? for lazy)
(…) (?:…) (?<name>…)
capture, non-capturing, named group
(?=…) (?!…) (?<=…)
lookahead, negative lookahead, lookbehind
a|b
a or b

How to test a regex

  1. Type your pattern and choose flags such as g or i.
  2. Paste the text to test; matches are highlighted live.
  3. Add a replacement to preview the result.

Uses the JavaScript (ECMAScript) regex engine, including lookbehind and named groups.

Frequently Asked Questions

JavaScript. Most syntax is shared with PHP (PCRE), Python and Java, but some features differ.

Use $1, $2 and so on, or $<name> for named groups. $& inserts the whole match.

Related Tools

JSON Formatter

Format and validate JSON data with syntax highlighting.

Open Tool →

Password Generator

Generate strong secure passwords with custom options.

Open Tool →

QR Code Generator

Generate QR codes for URLs, text, email, and more.

Open Tool →

Markdown to HTML

Convert Markdown to clean, sanitized HTML with a live preview. Supports tables and task lists.

Open Tool →