Free Regex Tester
Test and debug regular expressions in real-time. See matches highlighted, view capture groups, and use common patterns as starting points.
Common Patterns
Regex Quick Reference
How to Use the Regex Tester
Enter Your Regex Pattern
Type your regular expression pattern in the pattern input field. Do not include the surrounding slashes - just enter the pattern itself (e.g., \d{3}-\d{4} for phone numbers).
Set Regex Flags
Toggle the flags you need: g (global - find all matches), i (case insensitive), m (multiline), or s (dotall - dot matches newlines). Most patterns use the global flag.
Paste Test String
Enter or paste the text you want to test against your pattern. The tool highlights all matches in real-time as you type, making it easy to refine your regex.
Review Matches and Groups
View all matches highlighted in the test string. If your pattern has capture groups, see each group extracted separately. Copy individual matches or the full results.
Pro tip: Your data is processed entirely in your browser. Nothing is sent to any server, ensuring complete privacy.
About Regular Expressions
Regular expressions (regex) are powerful patterns used for matching, searching, and manipulating text. They are essential tools for developers, data analysts, and anyone working with text processing. Our regex tester helps you build and debug patterns with instant visual feedback.
Common Use Cases
- Validation: Check if emails, phone numbers, URLs, or other inputs match expected formats
- Search: Find specific patterns in large text files or codebases
- Extraction: Pull specific data from text using capture groups
- Replacement: Find and replace text matching complex patterns
- Parsing: Break down structured text like logs, CSVs, or markup
Frequently Asked Questions
What is a regular expression (regex)?
A regular expression is a sequence of characters that defines a search pattern. Regex is used for pattern matching in strings - finding, validating, extracting, or replacing text that matches specific patterns. They are powerful tools used in programming, text processing, and data validation.
What do the regex flags g, i, m, and s mean?
g (global) finds all matches instead of stopping at the first. i (case insensitive) ignores case when matching. m (multiline) makes ^ and $ match start/end of lines instead of the whole string. s (dotall) makes the dot (.) match newline characters as well.
How do I match an email address with regex?
A common email regex pattern is: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}. This matches most standard email formats. Note that perfectly validating all valid emails with regex is complex due to the email specification.
What is the difference between * and + quantifiers?
* matches zero or more occurrences (can match nothing), while + matches one or more occurrences (must match at least once). For example, a* matches "", "a", "aa", while a+ matches "a", "aa" but not "".
How do capture groups work in regex?
Capture groups are created with parentheses () and extract specific parts of a match. For example, (\d{3})-(\d{4}) matching "555-1234" creates two groups: "555" and "1234". Groups can be referenced in replacements as $1, $2, etc.
Is my regex pattern processed on a server?
No, all regex testing happens entirely in your browser using JavaScript's built-in RegExp engine. Your patterns and test strings never leave your device, ensuring complete privacy.
Related Tools
Format, validate, and beautify JSON data online. Syntax highlighting, error detection, tree view, and minification. Fix malformed JSON instantly.
Validate JSON syntax, format and beautify, minify, and get detailed statistics about your JSON data.
Convert CSV to JSON array instantly. Custom delimiters, header row detection, nested object support. Paste CSV or upload file. Perfect for data transformation.
Parse YouTube URLs to extract video IDs, playlist IDs, timestamps, and channel information.