How to Test Regular Expressions Online — Regex Guide
Regular expressions are powerful pattern-matching tools used in every programming language. But writing correct regex the first time is notoriously difficult. The Quill Tools Regex Tester lets you write, test, and debug regular expressions in real time — with live match highlighting, capture groups, and flag toggles.
Regex Fundamentals
Literal Characters
The simplest regex matches literal text: /hello/ matches the string "hello" anywhere in your text.
Metacharacters
.— Any character except newline^— Start of string (or line in multiline mode)$— End of string (or line)\d— Any digit (0–9)\w— Word character (a–z, A–Z, 0–9, _)\s— Whitespace character\b— Word boundary
Quantifiers
*— Zero or more+— One or more?— Zero or one (also makes quantifiers non-greedy:.*?){n}— Exactly n times{n,m}— Between n and m times
Common Regex Patterns with Examples
- Email validation:
/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$/ - Phone number (US):
/^+?1?s*(?d{3})?[s.-]?d{3}[s.-]?d{4}$/ - URL matching:
/https?://(www.)?[-a-zA-Z0-9@:%._+~#=]{1,256}.[a-zA-Z0-9()]{1,6}/ - IP address:
/^(d{1,3}.){3}d{1,3}$/ - Hex colour:
/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/
Using the Quill Tools Regex Tester
- Open Regex Tester.
- Enter your pattern in the regex field (without leading/trailing slashes).
- Toggle flags as needed: g (global), i (case-insensitive), m (multiline), s (dotAll), u (Unicode).
- Paste your test text. All matches are highlighted in real time.
- Capture groups are extracted and shown below the match count.
Capture Groups vs Non-Capturing Groups
(pattern) creates a capturing group — the matched text is extracted and numbered. (?:pattern) creates a non-capturing group that groups but doesn't extract. Use named groups (?<name>pattern) for readable extraction: /(?<year>\d{4})-(?<month>\d{2})/
Frequently Asked Questions
What regex flavor does Quill Tools' tester use?
The JavaScript native RegExp engine, broadly compatible with most modern programming languages and tools.
Can I test regex flags like global and case-insensitive?
Yes. Toggle flags for global (g), case-insensitive (i), multiline (m), dotAll (s), and Unicode (u) modes.
Test your regular expressions at Quill Tools Regex Tester.
You May Also Like
Share this article