How regex tester works
A regular expression (regex) is a pattern that matches text. Regex is used for validation, search-and-replace, data extraction, and parsing. This tester lets you write a pattern, apply it to test text, and instantly see all matches with their positions and capture groups.
Enter your pattern and optional flags (g for global, i for case-insensitive, m for multiline). The tester applies the regex to your test string and shows every match, its position in the text, and any capture groups. If the pattern is invalid, it shows the error message.
Regex can be complex, but the tester makes it interactive. Common patterns: d+ matches numbers, [a-z]+ matches lowercase letters, ^ and $ match start and end. Use capture groups with parentheses to extract parts of matches.
Frequently asked questions
What are regex flags?
Flags modify how the pattern matches. g finds all matches (global), i makes matching case-insensitive, m makes ^ and $ match line boundaries, and s lets . match newlines. The tester supports all standard flags.
What are capture groups?
Parentheses in a regex create capture groups that extract parts of the match. For example, (d+)-(d+) matching 123-456 captures 123 and 456 as separate groups. The tester shows all groups.
How do I match numbers?
Use d+ to match one or more digits. For decimals, use d+.d+. For negative numbers, use -?d+.?d*. The tester shows all matches instantly.
Why is my regex invalid?
Common errors: unmatched parentheses, invalid escape sequences, or quantifiers with nothing to repeat. The tester shows the exact error message and position to help you fix it.