Real-time · Visual · Free

Online Regex Tester
& Debugger

Test, debug, and learn regular expressions with real-time match highlighting, group capture details, and a built-in pattern library.

/ /
g m i s
Test String
Matches
0 matches
Match Details
Enter a regex pattern and test string to see matches.

Common Regex Patterns

Click any pattern to load it into the tester.

Regex FAQs

Frequently asked questions about regular expressions.

Regular expressions (regex or regexp) are sequences of characters that define a search pattern. They are used to match, find, replace, and validate strings of text. Regex is supported in virtually every programming language — JavaScript, Python, Java, PHP, Ruby, Go, and more — with minor syntax differences between flavors. They are extremely powerful for tasks like form validation, text parsing, log analysis, and data extraction.
. — any character except newline | * — 0 or more | + — 1 or more | ? — 0 or 1 (optional) | ^ — start of string | $ — end of string | \d — digit [0-9] | \w — word character [a-zA-Z0-9_] | \s — whitespace | [abc] — character class | (abc) — capture group | a|b — a or b | {n,m} — between n and m repetitions | \b — word boundary
g (global) — find all matches, not just the first. i (insensitive) — case-insensitive matching. m (multiline) — make ^ and $ match the start and end of each line, not just the whole string. s (dotall) — make the dot (.) match newline characters as well. u (unicode) — enable full Unicode support.
A capture group, written as (pattern), lets you extract specific parts of a match. For example, in the email pattern (\w+)@(\w+)\.(\w+), group 1 captures the username, group 2 the domain, and group 3 the TLD. In a replace operation, you reference them as $1, $2, $3. Named groups use the syntax (?<name>pattern) and are referenced as $<name>.