Regex Tester

Regex Tester

Test regular expressions against sample text with live match highlighting and capture group extraction.

Advertisement

Regular Expression
Test String
Highlighted Matches
⚠️

Disclaimer: This tool runs entirely in your browser -- nothing you enter is sent to or stored on our servers.

Regex Syntax Quick Reference

Regular expressions (regex) are patterns for matching, searching, and manipulating text. Core syntax: . (any character), * (0 or more), + (1 or more), ? (0 or 1), ^ (start), $ (end), [] (character class), () (capture group), | (OR). Quantifiers: {n} (exactly n), {n,m} (between n and m).

Common patterns: email validation ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$; Indian mobile number ^[6-9]\d{9}$. Flags: g (global -- find all matches, not just the first), i (case-insensitive), m (multiline -- ^ and $ match per line rather than per string). This tester highlights every match in real time as you type, making it fast to iterate on a pattern.

Worked Example

Pattern \b\w+@\w+\.\w+\b with the g flag against the sample text "Email me at hello@smartutilz.com or support@example.org" finds 2 matches: hello@smartutilz.com and support@example.org -- demonstrating a simplified (non-RFC-complete) email pattern useful for quick validation.

Frequently Asked Questions

Without the 'g' (global) flag, a regex match operation stops after finding the first match in your text. With 'g' enabled, it continues scanning and finds every non-overlapping match in the entire string -- essential when you want to count or highlight all occurrences, not just the first one.
By default, ^ and $ match only the very start and very end of the entire input string. Enable the 'm' (multiline) flag to make ^ and $ match the start and end of each individual line within a multi-line string instead.
This tester uses your browser's native JavaScript RegExp engine, so it supports the full JavaScript regex feature set (lookaheads, lookbehinds, named groups, unicode property escapes, etc.) -- but note that JavaScript regex syntax differs slightly from other languages like Python (PCRE) or PHP, so a pattern tested here should be re-verified if you're deploying it in a different language's regex engine.
Advertisement