Regex Tester
Test regular expressions against your text with live match highlighting, capture groups, flags, and a library of common patterns.
Runs 100% in your browser
Shortcuts
- Copy the output
- Alt + Shift + C
Your input is saved in this browser only. Reset clears it.
Flags
Sample Patterns
Results
Highlighted Matches
How to use the RegEx Tester
-
Enter a pattern and choose flags such as g, i, or m.
-
Paste the text you want to test.
-
Review the highlighted matches and capture groups, then copy the pattern or a link to the test.
Example: Extracting email addresses with capture groups
\b(\w+)@(\w+\.\w+)\b Contact ada@example.com or grace@dev.io today
Match 1 Full match: ada@example.com (index 8, length 15) Group 1: ada Group 2: example.com Match 2 Full match: grace@dev.io (index 27, length 12) Group 1: grace Group 2: dev.io
Each capture group is listed separately, which is what you get back from match() or matchAll() in code.
Frequently Asked Questions
What is a regular expression?
A regular expression (regex) is a sequence of characters that forms a search pattern. Regex is used for string matching, input validation, find-and-replace operations, and data extraction in virtually every programming language including JavaScript, Python, PHP, and more.
What are regex flags and what do they do?
Regex flags modify how a pattern matches text. The most common flags are: g (global) — find all matches, not just the first; i (case-insensitive) — match uppercase and lowercase equally; m (multiline) — ^ and $ match the start and end of each line; s (dotAll) — the dot (.) also matches newline characters.
How do I match a literal special character in regex?
Escape the character with a backslash (\). For example, to match a literal dot use \., a literal parenthesis use \(, and a literal backslash use \\. Characters that need escaping in regex include: . * + ? ^ $ { } [ ] | ( ) \
How do I test a regex pattern online for free?
Paste your pattern into the Pattern field and your test string into the Test String field in DevBottle's RegEx Tester. It highlights all matches in real time, shows capture group values, and lets you toggle all standard flags — no signup or installation needed.
About the RegEx Tester
The RegEx Tester is a powerful tool for creating, testing, and debugging regular expressions. Whether you're validating form inputs, parsing text, or extracting data patterns, this tool helps you visualize and refine your regular expressions in real-time.
New to regex? How to Write a Regular Expression builds real patterns step by step, and the JavaScript Regex Cheat Sheet is a quick syntax reference.
What are Regular Expressions?
Regular expressions (regex or regexp) are sequences of characters that define a search pattern. They are used for pattern matching within strings and are supported in most programming languages. Regular expressions can be simple, like finding all occurrences of a specific word, or complex, like validating email addresses or extracting structured data from text.
Features of Our RegEx Tester
Real-time Testing
See your regex matches instantly as you type, with visual highlighting of matched text and capture groups. This immediate feedback helps you quickly refine your patterns.
Capture Group Extraction
View all captured groups separately, making it easy to understand how your regex is breaking down the text and extracting specific components.
Regex Flags Support
Toggle various regex flags like global (g), case-insensitive (i), multiline (m), and others to modify how your pattern behaves when matching text.
Common Pattern Library
Access a library of commonly used regex patterns for emails, URLs, phone numbers, dates, and more. Use these as starting points for your own patterns.
Common RegEx Use Cases
- Form validation - Ensure user inputs match required formats (emails, passwords, phone numbers)
- Data extraction - Pull specific information from unstructured text or logs
- Search and replace - Find and modify text patterns in documents or code
- Text parsing - Break down complex strings into meaningful components
- URL routing - Match URL patterns in web applications
- Syntax highlighting - Identify code elements for proper formatting
RegEx Quick Reference
| Symbol | Description | Example |
|---|---|---|
. | Matches any character except newline | a.c matches "abc", "adc", etc. |
^ | Matches start of string | ^hello matches "hello world" |
$ | Matches end of string | world$ matches "hello world" |
* | 0 or more occurrences | ab*c matches "ac", "abc", "abbc", etc. |
+ | 1 or more occurrences | ab+c matches "abc", "abbc", but not "ac" |
Pro Tip
When working with complex regular expressions, build them incrementally. Start with a simple pattern that matches part of what you need, then gradually add complexity while testing at each step. This approach makes it easier to identify and fix issues.