๐Ÿ” Regex Tester

Write a regular expression and test it against sample text with live match highlighting and capture groups.

/ /
Flags: g (global), i (case-insensitive), m (multiline), s (dotall)

Frequently Asked Questions

Which regex syntax does this tool use?

This tool uses JavaScript's native RegExp engine, so it supports standard JS regex syntax โ€” character classes, quantifiers, anchors, lookaheads/lookbehinds, named groups, and the flags g, i, m, s, u and y.

What do the g, i, m and s flags do?

"g" finds all matches instead of stopping at the first. "i" makes matching case-insensitive. "m" makes ^ and $ match the start/end of each line instead of the whole string. "s" lets "." match newline characters too.

How do I see capture groups?

Add parentheses around parts of your pattern, e.g. (\w+)@(\w+). Each match's captured groups โ€” including named groups using (?<name>...) โ€” are listed below the highlighted text.

Why does my pattern show an error?

If the pattern or flags are invalid (e.g. unbalanced parentheses, or using "g" twice), JavaScript's RegExp constructor throws an error, which is shown so you can fix the syntax.

Is my text or pattern sent anywhere?

No. All matching happens instantly in your browser using JavaScript's built-in RegExp โ€” nothing is sent to a server.

What's the difference between greedy and lazy quantifiers?

Quantifiers like * and + are greedy by default โ€” they match as much text as possible. Adding a ? after them (e.g. *? or +?) makes them lazy, matching as little text as possible while still satisfying the pattern.

Why does "g" affect whether I see one match or all matches?

Without the "g" flag, JavaScript's regex methods stop after the first match. With "g", this tool finds and highlights every non-overlapping match in the test string, and lists each one with its capture groups.

How do I match a literal special character like . or *?

Escape it with a backslash, e.g. \\. matches a literal dot and \\* matches a literal asterisk. Without the backslash, these characters have special meaning (. matches any character, * means "zero or more").

About Privacy My Account
Powered by AppCafe.in