Developer Tools

Tools for developers

Regex Tester

Test JavaScript regex matches, replacements, split results, and common syntax explanations in your browser.

JavaScript Regex Tester

Simple regex testing in the browser

Enter a pattern, choose flags, paste sample text, and switch between match, replace, split, and explain. Everything updates instantly and nothing is uploaded.

Free to useRuns in your browserNo signup requiredInstant resultsGood for JavaScript regex testing

Enter the JavaScript regex source without surrounding slashes.

Pick a common regex and auto-fill the tester.

Simple email matching across multiple lines.

g = global, i = ignore case, m = multiline, s = dotAll, u = Unicode, y = sticky.

Sample text

Paste the text you want to test. Multi-line input is supported.

Matched2 matches

Highlighted text

Match ranges are highlighted in blue. Zero-width matches use small markers.

[email protected]
[email protected]
not-an-email

Match results

Each result shows the text and its position.

Regex Tester is an online JavaScript regex tester that lets you enter a regex pattern, add flags, paste sample text, and see the result immediately.

This page is designed for quick everyday tasks such as checking whether a regex matches, finding all matches, replacing text, splitting text, and understanding common regex syntax.

It is useful for developers, students, marketers, and anyone who needs to test a regular expression without opening an IDE or writing code first.

Everything runs in your browser, so your regex pattern and sample text stay on your device. It is free to use and does not require sign-up.

1. If you are not sure where to start, pick a preset such as Email, URL, Date, or Remove extra spaces. The page will fill in a working example for you.

2. Enter your regex pattern in the pattern box. Only enter the pattern itself. Do not type the surrounding /slashes/ because flags are entered separately.

3. Choose the flags you need, such as g to find all matches, i to ignore case, or m to work line by line.

4. Paste your sample text into the large text box. The page updates instantly, so you can edit the text and regex at the same time.

5. Open Match to check whether the regex works, Replace to preview replacements, Split to break text into parts, or Explain to read a simple syntax guide.

6. When you get the result you want, use Copy regex, Copy output, or Share link to save the current test.

Step 1: Email pattern

^[^\s@]+@[^\s@]+\.[^\s@]+$

Step 2: Flags

gm

Step 3: Sample text

[email protected]
[email protected]
not-an-email

Match mode shows whether the regex works, how many matches were found, where each match starts and ends, and which capture groups were returned.

Replace mode previews JavaScript replace() output, which is useful when you want to clean text, rename patterns, or reuse captured groups like $1 and $2.

Split mode shows the array returned by JavaScript split(), so it is easy to test separators, line breaks, commas, pipes, and other delimiters.

Explain mode gives a simple rule-based explanation for common regex syntax such as \d, \w, +, *, ?, [], (), ^, $, and |.

Presets, local storage, and shareable links make it faster to start, easier to return to your last test, and easier to send a working example to someone else.

Use \d when you want to match digits, \w for word characters, and \s for spaces or line breaks.

Use + when something should appear one or more times, * for zero or more times, and ? when something is optional.

Use [] to match one character from a set, such as [abc] or [0-9]. Use () when you want to capture part of a match for later use.

Use ^ to match the start of text and $ to match the end of text. Use | when either the left side or the right side should match.

If your regex looks advanced and the meaning is still unclear, switch to Explain mode to get a simpler breakdown before you keep editing.

Use Regex Tester when you want to validate an email address, username, phone number, date, or password rule before putting the regex into a form or script.

It is also useful for extracting values from copied text, removing extra spaces, finding numbers, replacing repeated patterns, and splitting text into arrays.

Because this page follows JavaScript regex behavior, it is a practical choice for Next.js, React, browser scripts, Node.js helpers, and front-end form validation.

For many visitors, the fastest workflow is simple: load a preset, replace the sample text with your own input, then adjust the pattern until the output looks right.