Utively Free Tool

Regex Tester

Test regular expressions with live match highlighting. See every match, capture group, and index in real time. Supports JavaScript flags g, i, m, and s.

Advertisement
/ /
No matches

Tip: Ctrl+Enter re-runs the test

Frequently Asked Questions

What are regular expressions (regex)?

Regular expressions (regex) are patterns used to match, search, and manipulate text. They are a compact mini-language built into almost every programming language. A regex pattern describes a set of strings — for example, \b\w+@\w+\.\w+\b matches simple email-like patterns. They are commonly used for input validation, search-and-replace, and text parsing.

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

g (global) — finds all matches instead of stopping after the first.
i (case-insensitive) — matches uppercase and lowercase equally, so hello also matches Hello and HELLO.
m (multiline) — makes ^ and $ match the start and end of each line, not just the whole string.
s (dotAll) — makes the dot . match newline characters as well as every other character.

How do I match a literal dot or special character?

Escape special characters with a backslash. In regex, the characters . * + ? ^ $ { } [ ] | ( ) \ all have special meanings. To match a literal dot, write \. — for example, the pattern \d+\.\d+ matches decimal numbers like 3.14. To match a literal backslash, write \\.

What are capture groups in regex?

Capture groups are portions of the pattern wrapped in parentheses ( ). When a match is found, each group captures the text matched by that part of the pattern. For example, (\w+)@(\w+) captures the username and domain of an email-like string separately. Groups are numbered from 1 in the order their opening parenthesis appears, and are shown in the Groups column of the results table below.

What is the difference between greedy and lazy matching?

Greedy quantifiers (like * and +) match as much text as possible. Lazy quantifiers (like *? and +?) match as little as possible. For example, given the input <b>hello</b>, the greedy pattern <.*> matches the entire string, while the lazy pattern <.*?> first matches <b> and then </b> as separate matches. Use lazy matching when you want the pattern to stop at the earliest valid end point.