nicetool.dev logo

Regex Tester

Uses your browser's JavaScript RegExp engine. Nothing is sent to a server.

//gi
Examples
Test string
Highlighted matches2 matches
Contact: [email protected], [email protected]
Visit https://nicetool.dev on 2026-09-24 from 192.168.1.10
Colors: #3b82f6 #fff #10b981
Match details
Match 1 · index 9
[email protected]
Match 2 · index 29
[email protected]

Cheat sheet

.
Any character except new line
\d
Digit (0-9)
\w
Word character (a-z, A-Z, 0-9, _)
\s
Whitespace
\b
Word boundary
^
Start of string / line
$
End of string / line
*
0 or more times
+
1 or more times
?
0 or 1 time (optional)
{n,m}
Between n and m times
[abc]
One of a, b or c
[^abc]
Not a, b or c
(...)
Capture group
(?<name>...)
Named capture group
a|b
a or b

What is a regular expression?

A regular expression (regex) is a pattern that describes a set of strings. Developers use regex to validate input like emails, search and replace text, and extract data from logs. This tester uses the same engine as your JavaScript code, so results match exactly.

Features

  • • Live highlighting of every match as you type
  • • Capture groups and named groups for each match
  • • Replace preview with numbered and named group references
  • • Ready-made patterns and a compact cheat sheet

Private by design

Your patterns and test data are processed entirely in your browser and only saved in local storage on your device.

No data leaves your browser.

How to use the Regex Tester

  1. 1

    Type your pattern in the regular expression field without the surrounding slashes, or start from one of the examples such as Email, URL or IPv4.

  2. 2

    Select the flags you need: g to find every match, i to ignore case, m to make ^ and $ work per line, s to let . match line breaks, u for Unicode.

  3. 3

    Paste the text to test. Matches are highlighted as you type and listed below with their position and every capture group.

  4. 4

    Turn on Replace to preview a substitution using $1, $2 or named groups, then copy the pattern into your JavaScript, TypeScript or other code.

Practical examples

Validating form input

Check a pattern for postal codes, phone numbers or usernames against both valid and invalid samples before it goes into your form validation.

Extracting data from logs

A pattern like (\d{3}) on an access log captures every HTTP status code, and the match list shows exactly what your script will extract.

Search and replace in code

Turn dates from 2026-10-03 into 03/10/2026 with the pattern (\d{4})-(\d{2})-(\d{2}) and the replacement $3/$2/$1, and check the result before running it on a whole project.

Learning regular expressions

Use the cheat sheet and change one token at a time to see how quantifiers, groups and anchors change the matches.

Frequently asked questions

Which regex flavor does this tester use?+

The JavaScript RegExp engine of your browser, the same one used by Node.js and TypeScript. Most syntax also works in Python, Java, PHP and Go, but lookbehind, named groups and some flags can differ.

Why does my pattern only find the first match?+

Without the g (global) flag a JavaScript regex stops after the first match. Turn on g to find all of them.

What is the difference between greedy and lazy quantifiers?+

.* is greedy and takes as many characters as possible, so <.*> matches from the first < to the last >. Adding ? makes it lazy: <.*?> stops at the first >.

Can a regex freeze the page?+

Yes. Nested quantifiers such as (a+)+ can cause catastrophic backtracking on long inputs. If the tester becomes slow, simplify the pattern or make the repeated parts more specific.