Regex Tester
Build, replace, and test regex patterns — everything runs locally.
What this does & how to use it
Paste or type your test string, enter a regex pattern, and toggle flags (g, i, m, s, u, y). The tool instantly shows matches, a highlighted preview, and lets you replace or split text.
- Matches lists each hit, index, and captured groups.
- Replace shows output after applying your pattern and replacement.
- Split breaks the text into parts wherever the pattern matches.
- Highlighted shows the test string with matches wrapped in
<mark>
. - Use the Presets row for common patterns (emails, URLs, numbers, dates, Eircode, etc.).
Tip: If you want to see every match, include the g
flag. For case-insensitive matching, add i
.
What this does & how to use it
Paste or type your test string, enter a regex pattern, and toggle flags (g, i, m, s, u, y). The tool instantly shows matches, a highlighted preview, and lets you replace or split text.
- Matches lists each hit, index, and captured groups.
- Replace shows output after applying your pattern and replacement.
- Split breaks the text into parts wherever the pattern matches.
- Highlighted shows the test string with matches wrapped in
<mark>
. - Use the Presets row for common patterns (emails, URLs, numbers, dates, Eircode, etc.).
Tip: If you want to see every match, include the g
flag. For case-insensitive matching, add i
.
Replace with
(or original if empty)Use $1
, $2
… to reference capture groups.
Matches are wrapped in <mark>
for quick visual scanning.
Quick regex cheatsheet
\d
\w
\s
^ $
+
*
?
( ... )
(?: ... )
A|B
[abc]
[^abc]
\.
Regex User Guide
What is a regular expression?
A regular expression (regex) is a compact pattern language for searching, extracting and transforming text. It’s supported across programming languages and tools.
How this tool works
- Pattern — the regex you want to test (e.g.
\d+
). - Flags — modifiers such as
g
(global),i
(ignore case),m
(multiline),s
(dotAll),u
(unicode),y
(sticky). - Test string — the input text. Results update as you type.
- Matches — each match with index and any capture groups.
- Replace / Split — preview replacements or split results immediately.
Common patterns (copy & paste)
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[A-Za-z]{2,}
(https?:\/\/)?([\w-]+\.)+[\w-]{2,}(\/[\w./%#?=&-]*)?
\b\d+(?:\.\d+)?\b
\b\d{4}-\d{2}-\d{2}\b
\b[A-Za-z0-9]{3}\s?[A-Za-z0-9]{4}\b
\s+
Flags reference
g
— global (find all matches)i
— ignore casem
— multiline (^
and$
match line boundaries)s
— dotAll (.
also matches newlines)u
— unicode modey
— sticky (match starting at lastIndex)
Tips
- Use
( ... )
to capture groups and reference them as$1
,$2
in replacements. - Escape special characters with
\
(e.g. use\.
for a literal dot). - Start simple; add anchors
^
and$
to control where matches occur.
Regex FAQ
What is regex used for?
Cleaning data, validating inputs (emails, Eircodes), parsing logs, transforming text, and search/replace tasks in editors and code.
Why doesn't my pattern match?
Check escaping (\\.
for a literal dot), anchors (^
, $
), and flags (i
for case-insensitive, g
for all matches).
Does this support Unicode?
Yes — enable the u
flag for Unicode mode.
How do I replace with capture groups?
Use $1
, $2
, etc. in the Replace with input.