capture groups

Regex Testercapture groups

Test and debug regular expressions online. Highlight matches, test flags, and view capture groups.

//g

How to use Regex Tester

1

Enter Your Regular Expression

Click the 'Pattern' input field at the top of the editor. Type or paste your regex pattern (e.g., ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$). The pattern box accepts all standard regex syntax including anchors, character classes, and quantifiers.

2

Input Text to Test Against

Click the 'Test String' textarea below the pattern field. Paste or type the text you want to match against your regex. You can test multiple lines by pressing Enter. The tool will immediately process and display results in real-time.

3

Select Regex Flags

Check the flag checkboxes on the right side: 'g' (global - find all matches), 'i' (case-insensitive), 'm' (multiline), 's' (dotall), 'u' (unicode). Selected flags will modify how your pattern matches. The interface shows which flags are currently active in green.

4

Review Highlighted Matches

View the test string area where all matches are highlighted in yellow or blue. Each match is numbered sequentially. Hover over highlighted text to see the exact character position and matched content in the tooltip.

5

Examine Capture Groups

Scroll to the 'Capture Groups' panel below the text area. This table shows all matched groups with their content, position, and length. Each row represents one captured group (Group 0 is the full match, Group 1+ are parenthesized subexpressions).

6

Check Match Count and Details

View the 'Results' summary box showing total matches found, execution time, and any regex errors. If your pattern has syntax errors, the error message appears in red text explaining the issue and line number.

Frequently Asked Questions

Related Tools