What is a regular expression?
A regular expression (regex) is a pattern that describes a set of strings. Regex is used in programming, text editors, and command-line tools for searching, matching, and replacing text. Common use cases include validating email addresses, extracting data from logs, and performing find-and-replace operations across codebases.
Flags explained
The g (global) flag finds all matches instead of stopping at the first. The i flag makes the pattern case-insensitive. The m (multiline) flag makes ^ and $ match the start and end of each line. The s (dotAll) flag makes . match newline characters too.
Capture groups
Parentheses () create capture groups that extract specific parts of a match. This tool shows each group's value in the match details, making it easy to debug complex patterns. All testing runs in your browser — your data stays private.