Skip to content

Regex Tester

Test regular expressions against sample text with live match highlighting.

Last updated August 27, 2026

Data
//g

2 matches

Contact us at hello@utils.sh or support@example.com for help.
Match details
  1. Match 1: hello@utils.shindex 14–28
  2. Match 2: support@example.comindex 32–51
Quick reference

Character classes

.Any character except line breaks
\d / \DDigit / non-digit
\w / \WWord character (letter, digit, _) / non-word
\s / \SWhitespace / non-whitespace
[abc]Any of a, b, or c
[^abc]Any character except a, b, or c
[a-z]Any character in the range a to z

Anchors & boundaries

^Start of string (or line, with the m flag)
$End of string (or line, with the m flag)
\b / \BWord boundary / non-word-boundary

Quantifiers

a*0 or more of a
a+1 or more of a
a?0 or 1 of a
a{2,4}Between 2 and 4 of a
a+?1 or more of a, non-greedy (as few as possible)

Groups & lookarounds

(abc)Capturing group
(?<name>abc)Named capturing group
(?:abc)Non-capturing group
a(?=b)Lookahead — a, only if followed by b
a(?!b)Negative lookahead — a, only if not followed by b
(?<=b)aLookbehind — a, only if preceded by b

About this tool

Regular expressions are notoriously hard to get right on the first try — a single misplaced character can change what a pattern matches entirely. This tool lets you test a JavaScript-flavored regex pattern against sample text in real time: toggle flags individually, see every match highlighted inline with its exact character offsets and capture groups, preview a find-and-replace substitution before you use it in code, and check the built-in quick reference if you forget a token's syntax.

Common regex flags

FlagNameEffect
gGlobalFind all matches, not just the first
iIgnore caseCase-insensitive matching
mMultiline^ and $ match start/end of each line
sDotall`.` also matches newline characters
uUnicodeEnables full Unicode pattern support
yStickyMatches only from the exact current position

Code examples

The second line (where shown) is the inverse operation.

LanguageCode
JavaScripttext.match(/pattern/g)
Pythonre.findall(r'pattern', text)
PHPpreg_match_all('/pattern/', $text, $matches)

Frequently asked questions

Which regex dialect does this use?

JavaScript's native RegExp engine, so syntax and flags match what you'd use in browser or Node.js code. Other languages (Python, PCRE, .NET) have mostly compatible but not identical syntax for some advanced features.

Why do I only see one match even though my pattern appears multiple times in the text?

Toggle on the `g` (global) flag. Without it, this tool mirrors real JavaScript behavior and only reports the first match — exactly what you'd get from `.exec()` or `.match()` without the global flag in actual code, so what you see here matches what your code will actually do.

How do I preview a find-and-replace before using it in code?

Check "Substitution" below the match list, then enter a replacement pattern using `$1`, `$2`, or `$<name>` to reference capture groups (or `$&` for the whole match). It runs your text through the same `String.replace()` logic JavaScript uses, so the preview is exactly what you'd get in real code.