Skip to content
DN
Esc
  • JSON FormatterBeautify, minify and validate JSON instantly as you type.
  • Base64 Encoder/DecoderConvert text to Base64 and back, with full Unicode support.
  • UUID GeneratorGenerate random v4 UUIDs — one or many — in the format you need.
  • JWT DecoderDecode JSON Web Tokens to inspect the header, payload and expiry.
  • Timestamp ConverterConvert Unix timestamps to dates and dates to timestamps.
  • URL Encoder/DecoderPercent-encode and decode URLs, and break down query strings.
  • Hash GeneratorGenerate MD5, SHA-1, SHA-256 and SHA-512 hashes of text or files.
  • Regex TesterTest regular expressions with live match highlighting and groups.

↑ ↓ to moveEnter to openPaste data to open it in the right tool. Nothing leaves your browser.

Regex Tester

Write a regular expression and see matches highlighted live, with capture groups, replace mode and presets. Uses your browser's JavaScript regex engine.

Last updated

//gi
Flags
Presets

Test string

Matches

Contact alice@example.com or support@example.org for help.
Docs: https://docs.example.com/guide?page=2&lang=en
Server 192.168.1.42 responded on 2026-09-26 (backup: 10.0.0.255).
Colors: #6366f1, #7c3aed and #fff.
Regex quick reference
.
Any character except line breaks
\d \w \s
Digit, word character, whitespace
\D \W \S
Not a digit, word character, whitespace
[abc] [^abc] [a-z]
Any of, none of, range
^ $
Start / end of string (or line with m)
\b
Word boundary
* + ?
0 or more, 1 or more, 0 or 1
{3} {2,} {2,5}
Exactly 3, 2 or more, between 2 and 5
*? +?
Lazy (as few as possible)
(abc)
Capture group
(?<name>abc)
Named capture group
(?:abc)
Non-capturing group
a|b
a or b
(?=abc) (?!abc)
Lookahead, negative lookahead
(?<=abc) (?<!abc)
Lookbehind, negative lookbehind
$1 $<name> $&
In replacements: group 1, named group, whole match

How to use the Regex Tester

  1. Write a pattern

    Type a regular expression, or start from a preset such as Email, URL or IPv4.

  2. Set flags

    Toggle flags like g (global), i (ignore case) and m (multiline) with one click.

  3. Add test text

    Matches are highlighted live, and the details table lists each match and its groups.

  4. Try a replacement

    Turn on Replace to preview the result using $1, $<name> or $& references.

Features

  • Live match highlighting as you edit the pattern or the test text
  • Flag toggles for g, i, m, s, u and y
  • Match details with the position, numbered groups and named groups of each match
  • Replace mode with $1, $<name> and $& references
  • Presets for email addresses, URLs, IPv4 addresses, dates, hex colors and key=value pairs
  • Runs in a background thread with a 1-second limit, so a runaway pattern can't freeze the page
  • A built-in quick reference of common regex syntax
  • Copy or download the list of matches (or the replaced text) — also with Ctrl/Cmd + Enter and Ctrl/Cmd + S

Privacy

Your pattern and test text are processed by a Web Worker created inside the page — a background thread running in your own browser. Nothing is sent to a server. If a match runs for more than one second, the worker is stopped and replaced.

Read the DevNest privacy policy

Examples

  • Find email addresses

    Flags g and i find every match, ignoring case.

    Pattern · text

    /[\w.+-]+@[\w-]+(?:\.[\w-]+)+/gi
    Contact ada@example.com or ops@example.org for access.

    Matches

    ada@example.com
    ops@example.org
  • Extract dates with named groups

    Named groups label each part of the match.

    Pattern · text

    /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/g
    Released 2026-09-27, patched 2026-10-02.

    Groups

    year=2026 month=09 day=27
    year=2026 month=10 day=02
  • Rearrange text with replace

    Use $1 and $2 to reorder captured groups. Loads with Replace turned on.

    Pattern · replacement

    /(\w+)@(\w+)\.com/g → "$2: $1"
    Emails: jane@example.com, sam@company.com

    Result

    Emails: example: jane, company: sam

Understanding regular expressions

What is a regular expression?

A regular expression (regex) is a pattern that describes text. Developers use regexes to validate input, search logs, extract values and perform find-and-replace. For example, this pattern matches a phone-style number such as 555-1234:

/\d{3}-\d{4}/

DevNest tests JavaScript (ECMAScript) regular expressions — the same engine your JavaScript and TypeScript code uses.

Capture groups

Parentheses capture part of a match. Groups are numbered from left to right, and you can name them with (?<name>…). Use (?:…) to group without capturing.

Pattern:  (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})
Text:     2026-09-27
Groups:   year = "2026", month = "09", day = "27"

Regex replace

  • $1, $2 … insert a numbered capture group
  • $<name> inserts a named group
  • $& inserts the whole match
  • $$ inserts a literal dollar sign
Pattern:      (\w+)@(\w+)\.com
Replacement:  $2: $1
Text:         jane@example.com
Result:       example: jane

Regex flags

FlagNameEffect
gglobalFind all matches instead of only the first
iignore caseMatch letters regardless of case
mmultiline^ and $ match at the start and end of each line
sdotAll. also matches line breaks
uunicodeFull Unicode matching, including \p{…} property escapes
ystickyMatch only at the current position

Common regex examples

PurposePattern
Digits only^\d+$
Email address (simple)[\w.+-]+@[\w-]+(?:\.[\w-]+)+
URLhttps?:\/\/[^\s/$.?#][^\s]*
Date (YYYY-MM-DD)\b\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])\b
Hex color#(?:[0-9a-fA-F]{3}){1,2}\b
Trailing whitespace (with m)[ \t]+$

Regex checks for email addresses and URLs are approximations. They're good for finding values in text, but the only reliable way to validate an email address is to send a confirmation email.

Frequently asked questions

Which regex flavor does this tester use?

It uses the JavaScript (ECMAScript) regular expression engine built into your browser. Most syntax is shared with other languages, but some features differ — for example, JavaScript doesn't support possessive quantifiers or inline modifiers like (?i).

How do I match a literal dot, bracket or other special character?

Escape it with a backslash. The characters . * + ? ^ $ { } ( ) | [ ] \ and / have special meanings, so write \. to match a dot or \( to match an opening parenthesis.

Why was my pattern stopped for taking too long?

Some patterns, such as (a+)+$, can take exponential time on certain inputs — this is called catastrophic backtracking. The tester stops any match that runs longer than one second. Make nested quantifiers more specific or use more precise character classes.

Why does my regex match an empty string?

Quantifiers like * and ? allow zero occurrences, so a pattern like \d* matches an empty string at every position. Use + instead of * if at least one character is required.

How many matches are shown?

Up to 1,000 matches are found and highlighted. The details table lists the first 200 of them.