Regex Tester

Updated July 2026

Test and debug regular expressions in real time. Enter a pattern and some sample text to see every match highlighted, with capture groups, match positions and flag controls — all running privately in your browser.

Enter a regular expression and some test text to see matches highlighted live, with capture groups — all in your browser. For example, the pattern \d+ matches one or more digits.
g global · i ignore case · m multiline · s dotall · u unicode
Matches
#IndexMatchGroups
No matches yet.

How this regex tester works

A regular expression — regex for short — is a compact pattern that describes a set of strings. This tester takes the pattern you type and the flags you select, compiles them with the browser's built-in JavaScript engine, and runs the pattern over your test text. Every match is highlighted in place, counted, and listed with its starting position and any capture groups.

Patterns are built from literal characters and special tokens. Shorthand classes like \d, \w and \s stand for digits, word characters and whitespace; quantifiers like *, + and ? control how many times the preceding item repeats; and parentheses ( ) create capture groups that pull out parts of a match. If your pattern is invalid the tester shows the exact error so you can fix it as you type.

Worked example: the pattern (\d{4})-(\d{2})-(\d{2}) with the test text 2026-06-02 produces one match, 2026-06-02, starting at index 0, with three capture groups: 2026, 06 and 02 — the year, month and day pulled out separately.

Common regex tokens

TokenMatches
\dAny digit, 0–9
\wA word character: letter, digit or underscore
\sAny whitespace: space, tab or newline
.Any single character (except newline, unless the s flag is set)
*Zero or more of the preceding item
+One or more of the preceding item
?Zero or one of the preceding item (optional)
^Start of the string (or line, with the m flag)
$End of the string (or line, with the m flag)
[ ]A character set, e.g. [a-z] for any lowercase letter
( )A capture group that remembers part of the match
|Alternation: match the pattern on either side

Reference note: this tool uses the JavaScript regular-expression syntax built into your browser. Some advanced features from other languages (such as lookbehind in older browsers) may behave differently, so test patterns against your own sample data.

Frequently asked questions

How do I test a regular expression?
Type your pattern into the pattern box and add some sample text in the test-string box. As you type, the tester compiles the expression and highlights every match, showing the count, each match position and any capture groups.
What are regex flags (g, i, m)?
Flags change how a pattern applies. g (global) finds all matches, i (ignore case) makes letters case-insensitive, and m (multiline) lets ^ and $ match the start and end of each line. The s (dotall) and u (unicode) flags are also supported here.
How do I match digits, letters or whitespace?
Use the shorthand classes: \d matches any digit, \w matches a word character (letters, digits or underscore) and \s matches whitespace. Add a quantifier such as + to match one or more, like \d+ for a run of digits.
What are capture groups?
Parentheses ( ) create a capture group that remembers the part of the match they surround. For example (\d{4})-(\d{2}) captures a year and a month separately, which this tester lists next to each match.
How do I match an email or phone number?
A simple email pattern is \w+@\w+\.\w+ and a basic phone pattern is \d{3}-\d{3}-\d{4}. These are starting points — real formats vary, so refine the pattern against your own sample data.
Is my text sent to a server?
No. The tester runs entirely in your browser using the built-in JavaScript regex engine. Your pattern and test text never leave your device and are not sent to a server.
⚡ Regex Tester — by larely ↗

Related tools

Cron Expression Generator

Build, explain and preview cron schedules with their next run times.

Aspect Ratio Calculator

Resize dimensions proportionally and simplify resolutions to a ratio.

Markdown Preview

Live Markdown-to-HTML preview with copyable HTML output.

Subnet Calculator

IPv4 CIDR subnet calculator: network, broadcast, mask and host range.

PX to REM Converter

Convert between px, rem, em and pt for CSS at any base font size.

Hash Generator

Generate SHA-256, SHA-1, SHA-384 and SHA-512 hashes in your browser.

JWT Decoder

Decode a JSON Web Token's header and payload .

Sort Text Lines

Sort, deduplicate, reverse, shuffle and clean a list of lines.

JSON to CSV Converter

Convert a JSON array to CSV and CSV back to JSON.

URL Encoder / Decoder

Percent-encode and decode text, and parse a URL into its parts.

Word Frequency Counter

Find the most-used words and keyword density in any text.

Image to Base64 Converter

Encode an image to a Base64 data URI for HTML or CSS, in your browser.

Browse all 251 free tools →