🔍

Regex Tester

Test regular expressions live with real-time match highlighting and capture group details.

//g
Hello World! Email me at alice@example.com or bob@company.org for more info.

2 matches

· 2 unique

Matches

#IndexFull MatchGroup 1Group 2
125alice@example.comaliceexample.com
246bob@company.orgbobcompany.org
About this tool

Test regular expressions as you type

This regex tester runs your pattern against sample text and highlights every match instantly. It uses your browser's JavaScript regular expression engine, so results match what new RegExp() does in JavaScript. Syntax from other languages (PCRE, Python) may behave differently.

How to use it

  1. Type a pattern between the slashes — no need to escape the slashes yourself.
  2. Toggle flags: g (global), i (case-insensitive), m (multiline) and s (dotAll).
  3. Paste your test string. Matches are highlighted and counted, with the number of unique matches.
  4. Check the match table for each match's position (index), full text and capture groups. The first 20 matches are listed.
  5. Click Copy /{pattern}/flags to copy it as a regex literal.

If the pattern is invalid, the browser's error message is shown under the input. Presets are included for email, URL, IPv4, phone, MM/DD/YYYY date, hex colour, HTML tags, JWT, UUID, credit-card-style numbers and Markdown bold and links.

Worked example

Pattern (\w+)@(\w+\.\w+) on Email me at alice@example.com or bob@company.org gives 2 matches:

#Full matchGroup 1Group 2
1alice@example.comaliceexample.com
2bob@company.orgbobcompany.org

Quick regex cheat sheet

  • \d digit, \w letter/digit/underscore, \s whitespace, . any character.
  • + one or more, * zero or more, ? optional, {2,4} 2 to 4 times.
  • ^ and $ start and end (of each line with the m flag).
  • ( ) capture group, (?: ) group without capturing, [abc] any one of a, b or c.

Frequently asked questions

Does the g flag change the results here?

The tester always finds every match so you can see them all. The g flag is still included in the copied pattern, where it matters in your code.

Are the presets perfect validators?

No. They are practical starting points — for example, the IPv4 preset also accepts 999.1.1.1. Test them against your own data.

More to explore

Related Developer Tools

Browse all tools from the same category.

Showing 1-2 of 48