Regex Tester & Debugger

Test and debug regular expressions with real-time match highlighting

manage_search Pattern
/ /
text_snippet Test String
checklist Matches 0
No matches yet
find_replace Replace

What are Regular Expressions?

Regular expressions (regex or regexp) are sequences of characters that define a search pattern. They are used in virtually every programming language for pattern matching, text search, validation, and string manipulation.

This online regex tester lets you write patterns and instantly see matches highlighted in your test text, with detailed information about match groups and indices.

Common Regex Patterns

Pattern Description Example Match
\d+One or more digits42, 2025
\w+@\w+\.\w+Simple email patternuser@mail.com
^https?://URL protocol prefixhttps://
[A-Z]{2,}Two or more uppercase lettersUSA, HTML

Frequently Asked Questions

What does the global (g) flag do?expand_more
The g flag makes the regex search for all matches in the string, not just the first one. Without it, the regex stops after finding the first match.
What are capture groups?expand_more
Capture groups are portions of a regex enclosed in parentheses (). They capture the matched text for later use. For example, (\d{4})-(\d{2}) captures the year and month separately from a date string.
How do I escape special characters?expand_more
Characters like . * + ? ^ $ { } [ ] | ( ) \ have special meaning in regex. To match them literally, precede them with a backslash: \. matches a literal dot.
Why is my regex slow on certain patterns?expand_more
Some patterns cause "catastrophic backtracking" when the regex engine tries exponentially many combinations. Avoid nested quantifiers like (a+)+. Use atomic groups or possessive quantifiers where supported.

Related Tools