Regex Tester

Write and test regular expressions with real-time matching, highlighting, and capture group extraction.

/ /

Common Regex Patterns

Email
[\w.+-]+@[\w-]+\.[\w.]+
URL
https?://...
IP Address
\b\d{1,3}\.\d{1,3}...
Date (DD/MM/YYYY)
\d{2}[/-]\d{2}[/-]\d{4}
Phone Number
[+]?\d{1,3}[\s-]?\d{4,14}
HEX Color
#([0-9a-fA-F]{6}|{3})

Regex Tester — Test Regular Expressions in Real-Time

This regex tester lets you write a regular expression and test it against sample text, seeing matches highlighted instantly as you type. It displays all matches, match positions, and the content of each capture group. The regex engine uses JavaScript's built-in RegExp, which is compatible with most modern programming languages for common patterns.

Regular Expression Flags

g (global) — find all matches, not just the first. i (case-insensitive) — match regardless of letter case. m (multiline) — ^ and $ match start/end of each line, not just the whole string. s (dotAll) — makes . match newline characters too. u (unicode) — enables full Unicode support. d (indices) — returns match index positions.

Common Regex Patterns — Quick Reference

Email: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} — URL: https?:\/\/[^\s]+ — Phone (India): [6-9]\d{9} — IP address: \b(?:\d{1,3}\.){3}\d{1,3}\b — Date (YYYY-MM-DD): \d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01]) — HTML tag: <([a-z][a-z0-9]*)\b[^>]*> — Digits only: ^\d+$ — Letters only: ^[a-zA-Z]+$

Capture Groups vs Non-Capturing Groups

Capture groups (pattern) remember the matched text for back-references and capture display. Named capture groups (?<name>pattern) give groups a name for easier reference. Non-capturing groups (?:pattern) group without capturing — useful for applying quantifiers to a pattern without the overhead of capturing. This tester displays all capture group contents below each match.

Lookahead and Lookbehind

Positive lookahead (?=...) — match if followed by. Negative lookahead (?!...) — match if NOT followed by. Positive lookbehind (?<=...) — match if preceded by. Negative lookbehind (?<!...) — match if NOT preceded by. Example: \d+(?= dollars) matches numbers followed by " dollars".

Enter your pattern in the Regex field and paste test text below. Matches highlight in real-time. Enable flags (g, i, m) as needed using the flag buttons.
JavaScript's built-in RegExp engine. It is compatible with most common regex syntax used in Python (for basic patterns), Java, Go, and other PCRE-based engines. Lookbehind requires a modern browser (Chrome 62+, Firefox 78+).
Escape it with a backslash: \. A plain dot (.) matches any character except newline. To match a literal period, use \. — for example, to match "3.14", use 3\.14.
+ means "one or more" matches. * means "zero or more" matches. \d+ requires at least one digit; \d* allows zero digits. Use + when the element is required, * when it is optional.
The global flag (g) finds all matches in the text instead of stopping after the first. Without g, the regex engine returns only the first match. Most regex use cases require g.