Real-time MatchingCapture GroupsBuilt-in Cheat Sheet
How It Works
1
Enter a Pattern
Type your regex pattern and select flags (global, case-insensitive, multiline, dotall).
2
Add Test Text
Enter the text you want to match against. Matches are highlighted in real-time.
3
Review Matches
See all matches with their positions, values, and captured groups listed below.
Frequently Asked Questions
What is a regular expression (regex)?
A regular expression (regex) is a sequence of characters that defines a search pattern. Regex is used for string matching, validation, search and replace, and text parsing. It is supported in virtually every programming language and many text editors.
What are some common regex patterns?
Common regex patterns include: email validation (^[\w.-]+@[\w.-]+\.\w{2,}$), phone numbers (\d{3}-\d{3}-\d{4}), URLs (https?://[\w.-]+), IP addresses (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}), and dates (\d{4}-\d{2}-\d{2}).
What do regex flags do?
Regex flags modify how the pattern is applied: g (global) finds all matches instead of stopping at the first, i (case-insensitive) ignores letter case, m (multiline) makes ^ and $ match line boundaries instead of string boundaries, and s (dotall) makes the dot (.) match newline characters.
What are capture groups in regex?
Capture groups are created by wrapping part of a regex pattern in parentheses (). They allow you to extract specific parts of a match. For example, (\d{4})-(\d{2})-(\d{2}) applied to "2024-01-15" captures three groups: "2024", "01", and "15". Non-capturing groups (?:...) match without capturing.
What are lookahead and lookbehind assertions?
Lookahead (?=...) and lookbehind (?<=...) are zero-width assertions that match a position without consuming characters. Positive lookahead (?=abc) matches if followed by abc. Negative lookahead (?!abc) matches if NOT followed by abc. Lookbehind works similarly but checks what comes before the current position.
Love this tool? Explore 999+ more
Free online tools for images, PDFs, text, code, and more. All running in your browser.
Explore All Tools