FastDevTool

Regex Tester

Test and debug regular expressions with live highlighting.

//g

Frequently Asked Questions

What is a regular expression?

+

A regular expression (regex) is a sequence of characters that defines a search pattern. It is used to find, match, or manipulate text by describing character combinations — for example, \d+ matches one or more digits, and [a-z]+ matches one or more lowercase letters. Regex is supported in virtually all programming languages and text editors.

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

+

The g (global) flag finds all matches in the string instead of stopping at the first one. The i (case-insensitive) flag makes the match ignore letter case. The m (multiline) flag makes ^ and $ match the start and end of each line rather than the whole string. The s (dotAll) flag makes the dot (.) character match newline characters, which it normally skips.

What is the difference between a greedy and a lazy quantifier?

+

Greedy quantifiers like *, +, and {n,m} match as many characters as possible. Lazy (non-greedy) versions like *?, +?, and {n,m}? match as few characters as possible. For example, given the string <b>hello</b>, the pattern <.*> greedily matches the entire string, while <.*?> lazily matches just <b>.

What are capture groups in regex?

+

Capture groups are portions of a pattern wrapped in parentheses that capture the matched text for later use. For example, the pattern (\d{4})-(\d{2})-(\d{2}) applied to a date string captures the year, month, and day as separate groups. Named groups use the syntax (?<name>pattern) and are accessible by name in most languages.

Why does my regex match too much or too little?

+

Overly broad matches are usually caused by greedy quantifiers or by forgetting to anchor the pattern with ^ (start) and $ (end). Undershooting often happens when special characters like ., *, or + are not escaped with a backslash when you intend to match them literally. Testing with this tool helps you immediately see what your pattern actually matches.