Regex Tester
Test and debug regular expressions in real time. Matches are highlighted as you type.
Frequently Asked Questions
What is a regular expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. It is used to find, match, and manipulate strings in text. Regex is supported in virtually every programming language including JavaScript, Python, Java, Go, and PHP.
What does the "g" flag do?
The "g" (global) flag makes the regex engine find all matches in the string instead of stopping after the first match. Without it, only the first match is returned.
What are capture groups?
Capture groups are portions of the regex wrapped in parentheses (). They allow you to extract specific parts of a match. For example, (\d{4})-(\d{2})-(\d{2}) matches a date and captures year, month, and day separately.
Why does my regex work here but not in my code?
This tester uses JavaScript regex. Different languages have slightly different regex flavors. For example, Python uses \A and \Z for start/end of string, while JavaScript uses ^ and $. Always check your language's regex documentation.