Regular expression
Flags
Quick insert
\d+ digit
\w+ word
\s+ space
[a-z]+
^ start
$ end
( ) group
\b boundary
[^\s]+
\d{4}
decimal
email
Test string
Matches highlighted (click to copy)
Frequently Asked Questions
What is a regular expression?
A regular expression (regex) is a pattern used to match, search, and manipulate text. It uses special characters like
\d (digit), \w (word character), ^ (start), $ (end), and + (one or more) to define flexible search patterns.What do the regex flags mean?
g (global) finds all matches, not just the first. i makes the match case-insensitive. m (multiline) makes ^ and $ match start/end of each line, not just the whole string. You can combine flags: gi = global and case-insensitive.How do I match a specific word?
Use
\bword\b — the \b is a word boundary anchor that ensures you match the full word, not part of a longer word. Example: \bcat\b matches 'cat' but not 'catch' or 'concatenate'.How do I create a capture group?
Wrap part of your pattern in parentheses:
(\d{4}) captures a 4-digit number. Named groups use (?<name>...). Groups are shown in the match info panel and can be referenced in replacements.Why is my regex matching too much?
Use quantifier qualifiers:
+ is greedy (matches as much as possible). +? is lazy (matches as little as possible). Example: <.+> matches the entire string if there are multiple tags, while <.+?> matches each tag individually.