Regex Tester
Write and test regular expressions against any text, with live match counting and result display.
Regular expressions (regex) are patterns used to match text. They are one of the most powerful tools in programming for validation, search, extraction, and transformation. A regex can match an email address format, extract all URLs from a document, validate a phone number, or find all 5-letter words in a paragraph. Every major programming language supports regex, though minor syntax differences exist between implementations.
Common flags: g (global — find all matches), i (case insensitive), m (multiline — ^ and $ match line boundaries). Combine as "gi" for all case-insensitive matches.
Frequently asked questions
What does \b mean in regex?
\b is a word boundary assertion. It matches the position between a word character (\w) and a non-word character. "\bfoo\b" matches the word "foo" but not "foobar" or "barfoo". It is essential for matching whole words without matching substrings.
What is the difference between .* and .*?
.* is greedy — it matches as many characters as possible. .*? is lazy (non-greedy) — it matches as few characters as possible. In HTML parsing, <.*> matches from the first < to the last > in a string, while <.*?> matches each individual tag.