No recently used tools
No favorite tools yet

Free Online Regex Tester - Regular Expression Checker & Debugger

91 uses
/ /
g Global
i Ignore Case
m Multiline
s Single Line
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

SymbolDescriptionExample
.Match any character (except newline)a.c → abc, adc
*Match 0 or more timesab* → a, ab, abb
+Match 1 or more timesab+ → ab, abb
?Match 0 or 1 timeab? → a, ab
{n}Match exactly n timesa{3} → aaa
^Start of string^Hello
$End of stringWorld$
[abc]Character set (match one of)[aeiou]
\dDigit (0-9)\d{4}
\wWord character (a-z, A-Z, 0-9, _)\w+
\sWhitespace (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

Q How can I understand the difference between greedy and non-greedy regex matching and test it using this online tool?
A 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.
Q Can I use this tool to clean up messy data from spreadsheets?
A 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.
Q Can I save my regex patterns for later use?
A 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.
Q Does this tool support lookahead and lookbehind assertions?
A 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.
Q Does adding more escaping fix mismatches with special characters?
A 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.
Q Why does my regex match nothing when I copy it from another tool?
A 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.
Q How to test a regex against a string with character limits, like a Twitter post or essay submission?
A 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.
Q Does regex tester support multiline matching or just single lines?
A It handles both with the right flags. Type your multiline text directly into the input field, then add the 'm' flag for multiline mode. Without it, ^ and $ match string start and end. With 'm' on, they match the start and end of each line. Try testing a poem or log file with errors on line 4 and 12 — the match count will show each line's hits separately. I use this daily for parsing server logs.
Q Is there a way to test regex against large files or only small pasted snippets?
A You can paste up to about 500KB of text straight into the input field, roughly 100,000 characters. That's enough for a full CSV export or a decent-sized log file. For anything bigger, split the file into chunks or test on a sample first — the highlighting engine will slow down on massive inputs. I usually grab 50-100 representative lines, test those, then run the full file through a script once the pattern is solid.
Q Is there a way to highlight all matches at once or only one occurrence?
A You'll see every match highlighted immediately, but each one gets a slight color shift based on its position. The match counter at the bottom shows the total count and character offset for each occurrence. Click any highlighted match to lock focus on that specific one, and the position details update in real time. This makes it easy to walk through matches one by one. For a clean overview, the occurrence list on the right side acts like a clickable map of your entire string.

How to Use

Related Tools