How this calculation works
The Regular Expression (Regex) Tester validates JavaScript-compatible RegExp patterns against test strings, displaying match counts, captured groups, and match positions.
Mathematical formula and logic
Evaluated using standard ECMAScript RegExp execution engine with capture group extraction.
Worked example
Testing an email regex against 'Contact us at support@calculatorall.online or admin@example.com' finds 2 matches: 'support@calculatorall.online' and 'admin@example.com'.
Calculation assumptions
- Standard JavaScript ECMAScript regular expression syntax.
- Catches syntax errors gracefully without crashing the UI.
Frequently asked questions
What does the 'g' flag do in regex?
The 'g' (global) flag searches for all matches throughout the entire string rather than stopping after the first match.
What does the 'i' flag do in regex?
The 'i' (ignore case) flag makes pattern matching case-insensitive so that 'a' matches both 'a' and 'A'.
What is the difference between .* and .*? in regex?
`.*` is greedy and matches as many characters as possible; `.*?` is non-greedy / lazy and matches the fewest characters necessary.
What are lookaheads and lookbehinds?
Lookaheads (`(?=...)`) and lookbehinds (`(?<=...)`) are zero-width assertions that check whether a pattern follows or precedes the current match position without including it in the match result.
How do I match any digit in regex?
Use `\d` or `[0-9]` to match any numeric digit from 0 to 9.