Free · Live · Client-Side Only
Test regular expressions in real time. Live match highlighting, capture groups, and match positions. Supports g, i, m, s flags.
What is a regular expression (regex)?
A regular expression is a pattern that describes a set of strings. It is used to search, match, and manipulate text. For example, \d+ matches one or more digits, [a-z]+ matches one or more lowercase letters. Regex is supported in JavaScript, Python, Java, Go, and nearly every programming language.
What do the regex flags g, i, m, s mean?
g (global): find all matches, not just the first. i (case-insensitive): match regardless of letter case. m (multiline): ^ and $ match start/end of each line, not just the whole string. s (dotAll): dot (.) matches newline characters too. Flags can be combined: /pattern/gim.
What are capture groups in regex?
Capture groups are parts of a regex wrapped in parentheses that capture the matched text separately. For example, (\d{4})-(\d{2})-(\d{2}) matches a date and captures year, month, and day in groups 1, 2, 3. Named groups use (?<name>...) syntax. Non-capturing groups use (?:...) to group without capturing.
What is the difference between .* and .*? (greedy vs lazy)?
Greedy quantifiers (*, +, ?) match as much as possible. Lazy quantifiers (*?, +?, ??) match as little as possible. For example, given <a>text</a>, <.*> greedily matches the whole string, while <.*?> lazily matches only <a>. Adding ? after a quantifier makes it lazy.
What are anchors (^ $ \b) in regex?
^ matches the start of a string (or line in multiline mode). $ matches the end. \b is a word boundary — the position between a word character (\w) and a non-word character. \B is a non-word boundary. Anchors match positions, not characters — they do not consume any text.
How do I match a literal dot, bracket, or other special character?
Escape special characters with a backslash. For a literal dot: \. For a literal bracket: \[. For a backslash: \\. Special regex characters needing escapes: . * + ? ^ $ { } [ ] | ( ) \. All must be escaped with \ to be matched literally.
| Feature | Anvya AI | regex101.com | regexr.com |
|---|---|---|---|
| Live match highlighting | ✓ | ✓ | ✓ |
| Capture group details | ✓ | ✓ | ✓ |
| Match position shown | ✓ | ✓ | Partial |
| g i m s flags | ✓ | ✓ | ✓ |
| No ads | ✓ | ✗ | ✗ |
| Works offline | ✓ | ✗ | ✗ |
| Free forever | ✓ | ✓ | ✓ |