Test and debug regular expressions with real-time match highlighting. Supports all JavaScript regex flags and capture groups. 100% client-side.
// updated April 2026A regular expression (regex) is a sequence of characters that defines a search pattern. Regex is used in programming for string searching, validation, and text manipulation across virtually every language.
JavaScript regex uses the RegExp object or literal syntax /pattern/flags. See our full regex cheat sheet and guide to the best regex testers for JavaScript.
g (global) — finds all matches, not just the first one.
i (case insensitive) — matches regardless of uppercase or lowercase.
m (multiline) — makes ^ and $ match start/end of each line.
s (dotall) — makes . match newline characters too.
regex.test(string) to check if a pattern matches, or string.match(regex) to get the matches. For all matches use the g flag with string.matchAll(regex). See our guide: best regex testers for JavaScript.(pattern) lets you extract a specific part of a match. For example (\d{4})-(\d{2})-(\d{2}) matches a date and captures year, month, and day separately. Use (?:pattern) for a non-capturing group when you don't need the value. Full reference in our regex cheat sheet.[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}. Click "Load Sample" above to see it in action with test data. Note that perfectly validating all email formats with regex is complex — for production use, consider a dedicated validation library..* match as much as possible. Lazy quantifiers like .*? match as little as possible. For example, given <b>text</b>, the greedy <.*> matches the whole string, while the lazy <.*?> matches just <b>.\bword\b. The \b anchor matches the position between a word character and a non-word character. For example \bcat\b matches "cat" but not "catch" or "concatenate".