Regex Tester & Visualizer

Test and debug regular expressions in real-time with match highlighting, capture groups, and detailed match information.

  1. Home
  2. > Web Dev > Laravel Tools >
  3. Regex Tester

Regex Pattern

/ /gm

Enter a PCRE-compatible regex pattern without delimiters.

Test Text

Match Results

No matches
Enter a pattern and test text to see matches highlighted here.

Match Details

Matches will appear here with position, group, and capture group information.

How to Use the Regex Tester

  1. Enter a regex pattern — Type a PCRE-compatible pattern in the input (without delimiters).
  2. Toggle flags — Enable g (global), i (case-insensitive), m (multiline), and more.
  3. Type or paste test text — The text you want to search through.
  4. Watch it update — Matches are highlighted in real-time with color-coded groups.
  5. Inspect matches — Each match shows its position, full match, and capture groups below.

Tip

Click Load Example to try a sample regex for extracting email addresses from text.

Frequently Asked Questions

What is a regular expression?

A regular expression (regex) is a sequence of characters that define a search pattern. They are used for pattern matching, text validation, search-and-replace operations, and data extraction. This tool uses JavaScript's RegExp engine which is compatible with PCRE syntax.

What do the flags mean?

g (global) — Find all matches, not just the first. i — Case-insensitive matching. m (multiline) — ^ and $ match the start/end of each line. s (dotall) — Dot matches newlines. u (unicode) — Treat pattern and text as unicode. x (extended) — Ignore whitespace and comments in the pattern.

What are capture groups?

Capture groups are parts of a pattern enclosed in parentheses (). They "capture" the matched portion so you can extract specific parts. For example, (\w+)@(\w+) captures the username and domain separately from an email.

Is this tool compatible with PHP/Laravel regex?

JavaScript's RegExp engine is broadly compatible with PCRE (PHP) syntax for most common patterns. However, some PCRE-specific features like \K, possessive quantifiers, and recursive patterns may not work. For basic to intermediate patterns, the results will be the same.