Regex Tester
Test regular expressions against sample text online with detailed match positions, text spans, and capture group inspection.
Run tool
This regular expression testing tool allows developers and analysts to evaluate patterns against sample text online. When you enter a pattern and provide target text, the tool executes the expression and displays the total number of matches along with detailed breakdown information. For each match found, the output lists the exact start and end character indexes, the matched substring, and any numbered or named capture groups defined in your pattern. You can also specify optional matching flags to modify behavior: use i for case-insensitive matching, m for multiline mode, s for dot-all matching, x for verbose syntax, u for Unicode matching, and a for standard ASCII rules. Other flag characters are ignored during evaluation. If a pattern cannot compile or if either the pattern or sample text field is left empty, the tool reports an evaluation failure rather than partial results. Use this tool to verify search expressions, inspect captures, and refine data extraction rules.
Instructions
- Enter your regular expression in the Pattern field.
- Paste or type the text you want to test in the Text area.
- Optionally enter one or more modifier flags (such as i, m, s, x, u, or a) in the Flags field.
- Run the tool to evaluate the expression.
- Review the total match count, character positions, and captured group details in the output panel.
Examples
- Pattern: (\d{4})-(\d{2})-(\d{2}) with Text: The deadline is 2025-05-18 and release is 2025-06-01 produces two matches, extracting the year, month, and day into groups 1, 2, and 3.
- Pattern: (?P<user>[a-z]+)@(?P<domain>[a-z.]+) with Flags: i and Text: Contact support@example.com produces one match with named groups for user ('support') and domain ('example.com').
FAQ
Which regex flags are supported?
The tool recognizes six modifier characters: i for case-insensitive matching, m for multiline anchors, s to let the dot character match newlines, x for verbose patterns with ignored whitespace, u for Unicode properties, and a for ASCII-only matching. Other characters are ignored.
What happens if my regular expression syntax is invalid?
If a pattern contains invalid syntax or cannot be compiled, the tool reports an evaluation failure instead of returning match details.
Can I inspect named capture groups?
Yes. When your pattern uses named capture groups, such as (?P<name>pattern), the output panel lists the group names alongside their matched substrings and indices.
Why did the evaluation fail when my text field was empty?
Both a non-empty pattern and non-empty sample text are required for regular expression evaluation. Leaving either field blank causes the test run to report an evaluation failure.