Regex Tester

Test regular expressions in real-time with match highlighting.

How to Test a Regular Expression

  1. Enter your pattern — type your regex in the Pattern field (without slashes). Example: \b\w+@\w+\.\w+\b
  2. Set flags — use g for global, i for case-insensitive, m for multiline. Default is gmi.
  3. Enter test string — paste the text you want to match against.
  4. See results instantly — matches are highlighted, the match count shows, and each match with its position and groups is listed below.

Frequently Asked Questions

What regex flavour does this tester use?
This tester uses JavaScript (ECMAScript) regular expressions, which run natively in all modern browsers. Patterns follow the standard JS regex syntax. Supported flags: g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode).
What do the regex flags g, i, m mean?
g — global: find ALL matches (not just the first). i — case-insensitive: match regardless of case. m — multiline: ^ and $ match start/end of each line, not just the whole string. s — dotAll: the . character also matches newline characters.
What is a capture group in regex?
Capture groups are portions of a regex in parentheses, e.g. (\d{4})-(\d{2})-(\d{2}) captures year, month, and day separately from a date string. This tool shows captured groups in the Match List.
How do I make my regex case-insensitive?
Add the i flag. In the Flags field, type gi or gmi. With the i flag, /hello/i matches "Hello", "HELLO", "hElLo", etc.
How do I match a whole word (not partial)?
Use word boundaries \b around your pattern. For example, \bcat\b matches "cat" in "the cat sat" but not in "category". \b marks the transition between a word character (\w) and a non-word character.

Common Regex Patterns

Email: \b[\w.-]+@[\w.-]+\.\w{2,}\b
URL: https?://[^\s]+
Phone: \+?[\d\s()-]{7,}
IP Address: \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
HTML Tag: <[^>]+>
Hex Color: #[0-9a-fA-F]{3,8}\b
Date (YYYY-MM-DD): \b\d{4}-\d{2}-\d{2}\b
Postal Code (UK): [A-Z]{1,2}\d{1,2}[A-Z]?\s?\d[A-Z]{2}