1
OneClickUse
Converters Tool

Regex Tester

Test regular expressions live with match highlighting, groups, and replace preview.

Privacy-first workflows
Fast and simple
100% Free, no signup
//g
Matches (2)
Reach us at hello@oneclickuse.com or support@example.org for help.
Replaced output
Reach us at [hello at oneclickuse.com] or [support at example.org] for help.
Captured groups
Match #1: hello@oneclickuse.com at index 12
$1 = hello
$2 = oneclickuse.com
Match #2: support@example.org at index 37
$1 = support
$2 = example.org

Written by Anil Gautam · Updated

What do the g, i, m, s, u and y flags change?

With g on, the tester lists every match and Replace with changes all of them. Turn it off and only the first match is shown and replaced. The i flag ignores letter case. With m, ^ and $ match at every line break: ^\d+$ finds nothing in a test string with 12 and 34 on separate lines, and finds both numbers once m is ticked. The s flag lets the dot match a newline.

Unicode mode needs u. Without it, \p{L} matches the literal text p{L}, and the dot splits an emoji or any other character outside the Basic Multilingual Plane into two halves. Sticky mode, y, accepts a match only where the previous one ended, starting at position 0: \d with g and y finds 1 and 2 in 12a3 and stops at the a, while g alone also finds the 3.

How do replacement tokens and capture groups work?

Replace with follows the rules of JavaScript's String.replace. $1, $2 and so on insert numbered groups, $<name> inserts a group written as (?<name>...), $& inserts the whole match, $` and $' insert the text before and after it, and $$ writes a dollar sign. To turn DD-MM-YYYY dates into ISO order, use (\d{2})-(\d{2})-(\d{4}) with $3-$2-$1, and Due 07-10-2026, paid 15-10-2026 becomes Due 2026-10-07, paid 2026-10-15.

The Captured groups panel lists each match with its start index and every group by number, named groups included. A group that took no part in a match shows as undefined: (a)|(b) run on b reports $1 = undefined and $2 = b, and $1 in a replacement then inserts nothing.

Why does a pattern match too much or hang the page?

Quantifiers are greedy. On <b>bold</b> and <i>it</i>, the pattern <.+> returns one match covering the whole line, because .+ runs to the last >. Adding ? makes it lazy, and <.+?> returns the four tags separately. \w and \b treat only ASCII letters, digits and the underscore as word characters, so \w+ finds caf in café. With the u flag, [\p{L}\p{M}]+ keeps café and नमस्ते whole, while \p{L}+ alone splits the Hindi word, because its vowel signs and virama are combining marks.

Type the pattern as it would appear between slashes, with single backslashes. When you move it into a JavaScript string, as in new RegExp("\\d"), each backslash must be doubled. The test reruns on every keystroke inside the page, and nested quantifiers such as (a+)+$ can backtrack exponentially on a long run of a characters followed by something else, with each extra character roughly doubling the work. If the tab stops responding, shorten the test string or simplify the pattern. For literal text without regex syntax, Find and Replace is simpler.

How it works

How to test regex

STEP 01
Type your pattern (without slashes).
STEP 02
Toggle flags (g, i, m, s, etc.) and paste a test string.
STEP 03
Matches are highlighted; capture groups are listed; try replacements with $1, $2 syntax.
Learn more

Related guides

You might also need

Related tools

Converters
CSS Minifier & Beautifier
Minify CSS to ship smaller stylesheets or beautify for reading.
Use now
Converters
JavaScript Minifier & Beautifier
Minify or beautify JavaScript for production or debugging.
Use now
Converters
Markdown to HTML Converter
Convert Markdown to clean HTML with live preview.
Use now
Converters
HTML to Markdown Converter
Strip HTML to clean Markdown — useful for moving content into docs or static sites.
Use now
Converters
User-Agent Parser
Parse and decode browser User-Agent strings into browser, OS, device, and rendering engine.
Use now
Converters
HTTP Status Code Lookup
Search and learn 31 common HTTP status codes with plain-English meanings.
Use now
FAQ

Common questions