Regex Tester

Test and debug regular expressions

//g
global

How to use

Enter a regular expression pattern and a test string. Matches are highlighted in real time. Enable flags like global (g), case-insensitive (i), or multiline (m) to modify matching behavior. Capture groups are displayed for each match.

Examples

Extracting email addresses

Use an email pattern like [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]'{'2,'}' with the global flag to find all email addresses in a block of text.

Validating date formats

Test the pattern \d'{'4'}'- \d'{'2'}'- \d'{'2'}' against dates to verify they match the YYYY-MM-DD format. Enable global flag to find all dates in the text.

Matching HTML tags

Use <(\w+)[^>]*> to match opening HTML tags and capture the tag name. The capture group shows the tag name separately from the full match.

Frequently asked questions

What regex syntax does this tool support?

This tool uses JavaScript's native RegExp engine. It supports standard regex syntax including character classes, quantifiers, lookahead/lookbehind, named groups, and Unicode properties.

What are regex flags?

Flags modify how the pattern matches. g (global) finds all matches, i (case-insensitive) ignores letter case, m (multiline) makes ^ and $ match line starts/ends, and s (dotAll) makes . match newlines.

What are capture groups?

Parentheses in a regex create capture groups that extract specific parts of a match. For example, (\d'{'4'}')-(\d'{'2'}')-(\d'{'2'}') captures year, month, and day separately from a date string.

Why is my regex matching too much?

Quantifiers like * and + are greedy by default, matching as much as possible. Add ? to make them lazy (non-greedy). For example, .*? matches the shortest possible string.

Can I use this for other programming languages?

Most regex basics work across languages. However, some advanced features (lookbehind, Unicode properties, named groups) vary between JavaScript, Python, and other regex engines.

About this tool

Test and debug regular expressions with real-time matching, capturing groups, and flags. Supports JavaScript regex syntax.

All calculations are performed locally in your browser. Your data never leaves your device.