WebPiki

Regex Tester

Test regex patterns with match highlighting and group capture

//g

Overview

Enter a regex pattern and see matches highlighted in your test string in real time. Capture groups are displayed separately as well. Being able to test and iterate on patterns instantly saves a lot of debugging time.

Key Features

  • Real-time match highlighting
  • Capture groups displayed separately
  • Flag selection (g, i, m, s, u)
  • Match count and position information
  • Common regex pattern examples included

How to Use

  1. Write the regex pattern in the top input field.
  2. Select the flags you need (g, i, m, etc.).
  3. Enter the test string in the text area below.
  4. Matches are highlighted and capture groups are shown separately.

Tips

  • Enable the g (global) flag to find all matches. Without it only the first match is shown.
  • There is no perfect email regex. Do a simple format check with regex and verify with a confirmation email.
  • (?:...) is a non-capturing group -- it groups without adding to the capture results.

FAQ

Which regex engine does this use?
It uses JavaScript's RegExp engine. Most patterns are compatible with Python and Java regex, but some advanced features like lookbehind may vary by browser.
What are capture groups?
Capture groups are the parts of a pattern enclosed in parentheses (). They let you extract specific portions of the matched text, which is useful for pulling out particular values.
Can a complex regex cause performance issues?
Yes, patterns with nested quantifiers can cause catastrophic backtracking. With long test strings, this can freeze the browser. Be careful with patterns like (a+)+ or (a|a)+.