Free Online Regex Tester - Regular Expression Checker & Debugger
52 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
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.
Does adding more escaping fix mismatches with special characters?
Actually, over-escaping causes more problems than under-escaping. In our tester, only these characters need escaping inside a pattern: . * + ? ^ $ { } ( ) | [ ]. Adding a backslash before a letter like \s creates a special token instead of matching a literal s. Try typing \d\.\d in the tool to match 5.7, but not 57. If you're unsure, paste your pattern into the syntax reference panel it explains each escape.
Why does my regex match nothing when I copy it from another tool?
Different regex engines use slightly different syntax flavors. Our tool uses JavaScript's engine, which doesn't support some PCRE features like \K or recursive patterns. Also, check if your pattern has unescaped forward slashes — those cause silent failures here. For example, /\d+/ should just be \d+ without the delimiters. If your pattern worked in Python or PHP but fails here, strip out any flags or modifiers attached to the pattern string first. The syntax reference panel shows exactly which tokens this engine accepts.
How to test a regex against a string with character limits, like a Twitter post or essay submission?
Paste your text into the input field and write a pattern that uses quantifiers to enforce the limit. For example, ^.{1,280}$ checks that the entire string is between 1 and 280 characters, just like Twitter's tweet limit. The instant match counter will show green when your text passes and red when it fails. I use this to validate essay submission forms before pushing them live.
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