How to Use a Regex Tester
Regular expressions (regex) are patterns used to match character combinations in strings. They're used in virtually every programming language for search, replace, validation, and parsing operations.
Enter your pattern in the field above (without the slashes), select your flags, and type or paste your test string. Matches are highlighted in real-time in yellow. Below the highlighted output, each match is listed with its exact character position.
FAQ
What does the 'g' flag do?
The global flag makes the regex find all matches in the string, not just the first one. Without 'g', the regex stops after finding the first match.
What is a capture group?
Parentheses () create capture groups that let you extract specific parts of a match. For example, (\d{4})-(\d{2})-(\d{2}) matches a date and captures year, month, and day in separate groups.