Regex Tester
Free online regex tester. Test and debug regular expressions in real-time. Highlight matches, count results, and test with sample data. All processing is local and private.
Enter regex and test string...
How to Use Regex Tester
Enter Your Regex Pattern
Type your regular expression pattern in the pattern field. Use the flags (g, i, m) to control global matching, case-insensitivity, and multiline mode.
Enter Test String
Paste or type the text you want to test against in the test string field. Click "Sample" to load an example.
View Matches
Matches are highlighted in real-time as you type. The match count is displayed above the output. No match found? Check your pattern and flags.
Common Regex Patterns
| Pattern | Matches | Example |
|---|---|---|
| \\S+@\\S+\\.\\S+ | Email addresses | hello@example.com |
| \\b\\d{}[-.]?\\d{}[-.]?\\d{}\\b | Phone numbers | 555-123-4567 |
| https?://[^\\s]+ | URLs | https://example.com |
Frequently Asked Questions
What is a regular expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. It's used for pattern matching, string searching, and text manipulation. Regex is supported in virtually all programming languages and is a powerful tool for text processing.
What do the flags g, i, and m mean?
g (global) finds all matches instead of stopping at the first one. i (case-insensitive) ignores letter case when matching. m (multiline) makes ^ and $ match the start/end of each line instead of the whole string.
What are common regex patterns?
\d matches digits, \w matches word characters, \s matches whitespace, . matches any character, * means zero or more, + means one or more, ? means optional, [] defines a character set, () creates a capture group, and | means OR.
Why is my regex not matching?
Common issues include: forgetting to escape special characters (like . or +), not using the correct flags, or the pattern not matching the input format. Try testing with simpler patterns first, then build up complexity gradually.
Regex Quick Reference
Regular expressions are a powerful tool for text processing. Here are the most commonly used patterns:
Character Classes
\\d— any digit (0-9)\\w— any word character (a-z, A-Z, 0-9, _)\\s— any whitespace.— any character except newline[abc]— any character in the set