HomeAll toolsRegex Tester

Regex Tester

Test JavaScript regular expressions with live matches and capture groups.

Data is processed only in your browser
//2 matchesglobal
Test text
Matches
1. Aliceindex 13
2. Bobindex 23
Match highlight
DevKit helps Alice and Bob test regular expressions.

How to use

Regex Tester lets you test and debug JavaScript regular expressions in real time. Enter a regex pattern and test text, and the tool immediately highlights all matches with detailed capture group information.

How to use: Enter your regex pattern in the regex input (no surrounding slashes needed), and flags in the Flags box (e.g. g, i, m). Paste the test text below.

Common Regex Patterns

PurposePatternMatch Example
Email[w.-]+@[w.-]+.w+user@example.com
Phone (US)d{3}[-.]?d{3}[-.]?d{4}123-456-7890
IPv4d{1,3}.d{1,3}.d{1,3}.d{1,3}192.168.1.1
Date (YYYY-MM-DD)d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]d|3[01])2024-01-15
HTML Tag<([a-z]+)([^<]*)(?:>(.*)</\1>)?<div>content</div>

Regex Syntax Reference

SyntaxMeaningExample
.Any character (except newline)a.b → acb, axb
d / w / sDigit / Word char / Whitespaced+ → 123
[abc]Character set[aeiou] → vowels
(group)Capturing group(d+)-(w+)
(?:group)Non-capturing group(?:http|https)
(?<name>...)Named capturing group(?<year>d{4})
^ / $Start / End of line^hello$
* / + / ?0+ / 1+ / 0 or 1 timesab*c
{n,m}n to m timesd{2,4}

Flags Reference

  • g — Global match, find all matches
  • i — Case-insensitive
  • m — Multiline, ^ and $ match each line boundary
  • s — Dotall, . matches all characters including newline

Frequently asked questions

Which regex syntax is supported?

The tool uses the JavaScript regex engine, supporting most Perl-compatible features including capture groups, lookaheads, lookbehinds, and backreferences.

How do I test global matching?

Add the g flag in the Flags input to enable global matching. The tool will highlight all matches in the test string.

How do I view capture groups?

Match results display each capture group's content. Named groups (?<name>...) show both the group name and value, making complex regex debugging easier.

See all questions

Go deeper

Related tools