Free Online Regex Tester - Regular Expression Checker & Debugger
42 usesRegular Expression Pattern
/
/
g Globali Ignore Casem Multilines Single LineTest Text
Match Result
Enter a regex pattern above to start matching
Common Regex Templates
Email Address
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
URL
^https?://[\w.-]+(?:/[\w./?%&=-]*)?$
IPv4
^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}...
Date (YYYY-MM-DD)
^\d{4}[-/.](?:0[1-9]|1[0-2])[-/.]...
Numbers
\d+
Letters Only
[a-zA-Z]+
HTML Tags
<[^>]+>
Strong Password
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)...
Regex Syntax Reference
| Symbol | Description | Example |
|---|---|---|
. | Match any character (except newline) | a.c → abc, adc |
* | Match 0 or more times | ab* → a, ab, abb |
+ | Match 1 or more times | ab+ → ab, abb |
? | Match 0 or 1 time | ab? → a, ab |
{n} | Match exactly n times | a{3} → aaa |
^ | Start of string | ^Hello |
$ | End of string | World$ |
[abc] | Character set (match one of) | [aeiou] |
\d | Digit (0-9) | \d{4} |
\w | Word character (a-z, A-Z, 0-9, _) | \w+ |
\s | Whitespace (space, tab, newline) | \s+ |
| | Alternation (OR) | cat|dog |
() | Capture group | (\d{4})-(\d{2}) |
Regex Tips
Real-Time Matching
Matches are highlighted in yellow as you type. No need to click a button - results update instantly.
Regex Flags
Use g for global (all matches), i for case-insensitive, m for multiline, s for dotAll mode.
Quick Templates
Click any template below to load common patterns like email, URL, date, and IP validation.
Escape Special Chars
Remember to escape special characters like . * + ? with a backslash when matching literally.
Frequently Asked Questions
Why is my regex not matching?
Common issues include: forgetting to escape special characters (. matches ANY character), not using the correct flags (try adding i for case-insensitive), or incorrect quantifiers.
What is the difference between * and +?
* matches zero or more occurrences (including empty), while + requires at least one occurrence. For example, ab* matches a, ab, abb, while ab+ matches ab, abb but not a.
How do I test if my regular expression matches across multiple lines in the text?
To test regex patterns across multiple lines, ensure your input text includes newlines. Some regex engines require a specific flag, like 'm' (multiline), to allow anchors (^ and $) to match the start/end of lines, not just the entire string. This online regex tester instantly highlights matches, helping you visualize how your pattern handles line breaks and ensuring accurate multi-line parsing.
How can I see the exact start and end positions of each regex match in your online tester?
Our online Regex Tester highlights matches instantly and provides detailed information on each. Below the input fields, you'll find a list of all matches, clearly showing their starting and ending index positions within your text. This feature is crucial for debugging complex patterns and understanding precisely where your regex is capturing text segments, making it easier to integrate into your code.
How can I verify a regex pattern for form validation, like phone numbers or postal codes, using this online tool?
Our Regex Tester is ideal for validating form input patterns. Simply enter your desired regex in the pattern field and sample user inputs (valid and invalid) in the text field. The instant highlighting and match count will quickly show if your pattern correctly captures valid entries and rejects invalid ones, ensuring robust form validation before you implement it.
How do I use the built-in regex syntax reference to understand specific tokens like `\s` or `\b`?
Our Regex Tester includes a comprehensive syntax reference. Simply click on the 'Syntax Reference' tab or button to access it. You'll find explanations for common meta-characters like `\s` (whitespace), `\d` (digit), `\w` (word character), and anchors like `\b` (word boundary). This feature helps you quickly look up unfamiliar tokens and build your patterns correctly without leaving the testing environment.
How can I understand the difference between greedy and non-greedy regex matching and test it using this online tool?
Greedy matching attempts to match the longest possible string, while non-greedy (or lazy) matching, denoted by adding a `?` after a quantifier like `*` or `+`, matches the shortest possible string. To test this, enter a pattern like `<.*>` (greedy) and `<.*?>` (non-greedy) with text like `<div><span>Hello</span></div>`. Observe how the instant highlighting and match positions change, demonstrating the distinct behavior for effective regex debugging.
Can I use this tool to clean up messy data from spreadsheets?
Absolutely. This tool is fantastic for cleaning raw text data. You can quickly test patterns to remove extra spaces, standardize formats, or extract specific pieces of information. For instance, if you have a column with phone numbers like '123-456-7890' and ' (123) 456-7890 ', you can write a regex to capture just the digits and then use that pattern to replace all variations with a consistent format. It saves a ton of time compared to manual editing.
Can I save my regex patterns for later use?
This tool doesn't have a built-in save feature. You'll need to copy your pattern to a file or bookmark the page with your regex in the URL. For quick reuse, I keep a text file with my go-to patterns. The tool does include 10+ common templates like email, phone, and URL patterns you can load instantly.
Does this tool support lookahead and lookbehind assertions?
Yes, it fully supports both lookahead and lookbehind. You can test patterns like (?=...) for positive lookahead or (?<=...) for positive lookbehind. For negative versions, use (?!...) and (?<!...). These are critical for matching text only when preceded or followed by certain patterns without including those conditions in the match. Try (?<=@)[a-z]+ to find usernames in emails without capturing the @ symbol. Works in all major regex flavors.
How to Use
- Enter your regex pattern between the / delimiters
- Toggle flags (g, i, m, s) by clicking the flag buttons
- Enter or edit the test text in the text area below
- Matches are highlighted in yellow in the result area
- Check match count and positions in the stats above the result
- Use the Common Templates section to quickly load popular patterns