Free Online Regex Tester - Regular Expression Checker & Debugger
34 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
What is a regular expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. It is used to match, search, and manipulate text in programming languages and text editors.
What does the g flag do?
The g (global) flag finds all matches in the text, not just the first one. Without it, the regex stops after the first match is found.
How do I match an email address?
A common pattern is: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$. Click the Email template button to load this pattern.
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.
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