Developer Tools

Free Regex Tester

Test regular expressions with live match highlighting, capture group inspection and replace preview. Supports every JavaScript flag — all in your browser.

Live Matching 100% Private Capture Groups Replace Preview

Pattern & Test String

Regular expression
/ /
Test string
0 chars · 0 lines
Tip: the pattern updates live as you type. Try one of the preset examples above, or use $1, $& and $<name> in the Replace tab.

Results

Matches
0
Groups
0
Time
0 ms
Highlighted text
Matches will be highlighted here
Match details
Match details will appear here
Quick reference
\d
Any digit 0-9
\w
Word char a-z, 0-9, _
\s
Whitespace
.
Any char (except newline)
*
0 or more
+
1 or more
?
0 or 1
{n,m}
Between n and m
[abc]
Any of a, b or c
[^abc]
Not a, b or c
^
Start of string/line
$
End of string/line
\b
Word boundary
(a|b)
a or b (group)
(...)
Capture group
(?:...)
Non-capturing group
(?=...)
Lookahead
(?!...)
Negative lookahead

What Is a Regular Expression?

A regular expression (regex) is a mini-language for describing patterns in text. Instead of searching for a literal string like "hello", you write a pattern that matches any text fitting a rule — for example, \b\w+@\w+\.\w+\b matches any email address.

Regex is built into every major programming language and used everywhere: form validation, log parsing, search-and-replace, text editors, command-line tools like grep and sed, and even your browser's Find bar supports basic patterns.

The building blocks

SyntaxMatches
abcThe literal text "abc"
.Any single character except newline
\dAny digit 0–9
\wAny word character (letter, digit, underscore)
\sAny whitespace (space, tab, newline)
[abc]Any one of a, b or c
[^abc]Any character except a, b or c
a*Zero or more a's
a+One or more a's
a?Zero or one a
a{3}Exactly 3 a's
a{2,5}Between 2 and 5 a's
^Start of string (or line with m flag)
$End of string (or line with m flag)
\bWord boundary
(abc)Capture group — captures "abc"
(?:abc)Non-capturing group
(?<name>abc)Named capture group
a|ba or b (alternation)

The flags

FlagEffect
gGlobal — match all occurrences, not just the first
iIgnore case — "Hello" and "hello" match the same
mMultiline — ^ and $ match line boundaries too
sdotAll — . also matches newline characters
uUnicode — full Unicode matching, required for astral-plane characters and properties like \p{Emoji}
ySticky — matches only from the regex's lastIndex position

Capture groups and backreferences

Parentheses create capture groups. In a replacement string:

The three regex flavours

FlavourUsed byNotes
JavaScriptBrowsers, Node.jsWhat this tool uses. ECMAScript spec.
PCREPHP, grep -P, many othersMost feature-complete flavour. Adds recursion, atomic groups.
RE2Go, Rust, re2Linear-time engine. No backreferences, no lookbehind. Very fast.

Most patterns work identically across all three. The differences appear with advanced features like possessive quantifiers, variable-length lookbehind, and \p{...} Unicode properties (which JavaScript only supports with the u flag).

Catastrophic backtracking

Some patterns are correct but pathologically slow. The classic example is (a+)+b tested against 30 a's with no b at the end — the engine tries every possible combination of groupings, taking 2³⁰ steps. This can freeze a browser tab.

This tool guards against it by capping the number of steps and the test string length. If a regex is genuinely slow, it's usually a sign to rewrite it. The fix is often to remove nested quantifiers or replace (a+)+ with a+.

Common use cases

Form Validation

Verify email, phone, URL and postal codes before submission.

Log Parsing

Extract timestamps, IPs and error codes from log files.

Bulk Find & Replace

Rename variables or reformat text across many files at once.

Data Extraction

Pull emails, phone numbers or URLs out of unstructured text.

Code Refactoring

Find all function calls, imports, or comments matching a pattern.

Data Cleaning

Normalise messy CSV columns or strip unwanted characters.

Learning Regex

Experiment with patterns and see exactly what they match.

Debugging Patterns

Trace why a regex matches more or less than expected.

Privacy and security

This regex tester runs entirely in your browser. Matching uses the native JavaScript RegExp engine — the same one your code will use at runtime. Your pattern and your test string never leave your device, safe for internal data, proprietary formats and confidential text.

Frequently Asked Questions

What is a regex tester?
A regex tester is a tool that lets you write and test regular expressions against sample text. It shows which parts of the text match your pattern, exposes the capture groups, and lets you preview the result of a regex-based search-and-replace.
Which regex flavour does this tool use?
It uses JavaScript's native RegExp engine — the same one used by every modern browser. This is very close to the regex support in Node.js, and compatible with most patterns from other languages, though there are small differences in look-behind and named groups between flavours.
What do the flags mean?
g (global) matches all occurrences instead of just the first. i (ignore case) makes matching case-insensitive. m (multiline) makes ^ and $ match the start and end of each line. s (dotAll) makes . match newlines too. u (unicode) enables full Unicode matching for characters outside the BMP. y (sticky) matches only from the lastIndex position.
What is catastrophic backtracking?
Catastrophic backtracking is a performance bug where a regex like (a+)+b takes exponentially longer to fail on certain inputs. It can freeze the browser. This tool caps the number of steps and test string length to protect against it, but the real fix is to rewrite the regex — usually by avoiding nested quantifiers.
How do capture groups work?
Parentheses in a regex create capture groups. Group 1 is the first pair of parentheses, group 2 the second, and so on. In a replace string, refer to them as $1, $2, and so on. Named groups use (?<name>…) and are referenced as $<name>. The full match is always $&.
Can I use named capture groups?
Yes. Write (?<name>pattern) and reference the group as $<name> in the replace string. Named groups also appear in the match list under their name.
Does it work on mobile?
Yes. The tool is fully responsive. Tap any input to bring up the keyboard, and the results panel scrolls independently.
Is my data uploaded to a server?
No. All matching happens locally in your browser using the native RegExp engine. Your pattern and your test string never leave your device.
Is this regex tester free?
Yes. It is 100% free, requires no sign-up, and runs entirely in your browser.

Related Developer Tools

Done!