Guides · Regex

Regex Tester Online: Test and Debug Regular Expressions

How to test regular expressions online with real-time match highlighting, use regex flags correctly, read capture groups, and apply common patterns.

Last updated: May 4, 2026

What is a regex tester online?

A regex tester (short for regular expression tester) lets you write a pattern and immediately see which parts of your test text it matches — with match highlighting, capture group values, and the start and end position of each match. Testing in a dedicated tool is far faster than the trial-and-error loop of editing code, running it, and checking output.

JavaScript regex syntax is supported, which covers the vast majority of server-side use cases as well: Node.js, Python (with minor differences), Go, Ruby, and Java all share the same core syntax for the most common operations.

Regex flags reference

FlagNameEffect
gglobalFind all matches, not just the first one
iignoreCaseMatch uppercase and lowercase interchangeably
mmultiline^ and $ match start/end of each line, not just the string
sdotAll. matches newline characters in addition to all others
uunicodeEnable full Unicode matching and \ p{} category escapes
ystickyMatch only from lastIndex — like g but without advancing past misses

Essential metacharacter reference

TokenMatches
.Any character except newline
\dDigit [0-9]
\DNon-digit
\wWord character [a-zA-Z0-9_]
\WNon-word character
\sWhitespace (space, tab, newline)
\SNon-whitespace
\bWord boundary
^Start of string (or line with m)
$End of string (or line with m)
*0 or more (greedy)
+1 or more (greedy)
?0 or 1 (optional)
{n}Exactly n times
{n,m}Between n and m times
[abc]Character class: a, b, or c
[^abc]Negated class: anything except a, b, c
(x)Capturing group
(?:x)Non-capturing group
x|yx or y (alternation)

6 practical regex patterns

Email address\b[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Z|a-z]{2,}\b
UUID v4[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}
IPv4 address\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b
ISO 8601 date\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])
URL slug^[a-z0-9]+(?:-[a-z0-9]+)*$
Hex color#(?:[0-9a-fA-F]{3}){1,2}\b

Understanding capture groups

Capture groups let you extract specific parts of a match. Any part of a pattern wrapped in parentheses () is a capture group. Groups are numbered left to right starting at $1.

Pattern

(\w+)@(\w+\.\w+)

Test text: alice@example.com

Full match: alice@example.com
$1 (username): alice
$2 (domain): example.com

Use (?:) (non-capturing group) when you need to group tokens for quantifiers but do not need the value — for example (?:https?://)?\w+ makes the protocol optional without creating a capture group for it.

Common regex mistakes

Forgetting the g flag

Without the global flag, the regex engine stops after the first match. If you expect multiple matches, always add g.

Matching too greedily

Quantifiers like .* are greedy — they match as much as possible. Use .*? (lazy) to match as little as possible, especially inside HTML or JSON strings.

Not escaping dots in domains

In a regex, . matches any character. To match a literal dot in example.com, write example\.com.

Anchoring incorrectly

^ and $ match the start and end of the entire string by default. Add the m flag if you want them to match the start and end of each line.

Frequently asked questions

Which regex engine does the tester use?

The tester uses the JavaScript RegExp engine built into your browser. This covers the ECMAScript regex specification including all standard flags and syntax.

Does the tester support lookaheads and lookbehinds?

Yes. JavaScript supports positive and negative lookaheads ((?=x) and (?!x)) and lookbehinds ((?<=x) and (?<!x)) in modern browsers.

Why do I see different results in Python vs JavaScript?

Python uses the re module which has minor syntax differences from JavaScript: \A and \Z for string anchors, (?P<name>) for named groups, and slightly different Unicode support. For cross-language testing, prefer \d \w \s and character classes which work consistently.

What is the difference between .* and .+?

.* matches zero or more characters (including none), while .+ requires at least one character. Use .+ when you need at least one character to be present.

Is my regex or test text sent anywhere?

No. All matching runs client-side in your browser using the native JavaScript RegExp API. Nothing is transmitted.