No recently used tools
No favorite tools yet

Free Online Regex Tester - Regular Expression Checker & Debugger

383 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 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.
Q Why does my regex work in one tool but fail here when I test the same pattern?
A Regex engines differ in subtle ways, and this tester runs JavaScript's flavor. Features like \K, recursive patterns, or atomic groups from PCRE won't work here. Also, check for unescaped slashes — a pattern like /\d+/ from PHP breaks silently. The syntax reference panel on the right lists every supported token, so compare your pattern against it. Quick fix: strip delimiters and flags before pasting. Test a simple anchor like ^$ first to isolate whether the issue is the engine or your expression.
Q Can I convert special HTML characters safely before publishing a newsletter?
A Email marketers use regex to swap unescaped symbols with proper entities. Paste your HTML code into the box and run a find-and-replace pattern. For instance, target all ampersands not followed by a semicolon using `&(?![a-zA-Z0-9#]+;)`. The tool highlights every violation instantly. Swap them with `&amp;` before hitting send on your campaign. I do this every Tuesday to prevent broken layouts in Outlook.
Q Extracting values from JSON payloads
A Paste your raw API response into the input box to parse keys and values instantly. Write `"id":\s*"([^"]+)"` to grab all user IDs without writing a full parser script. The side panel lists every captured group clearly. I use this trick during frontend debugging when Postman takes too long to load. Try target keys like `"status":\s*true` next.

How to Use

Related Tools