Regex generator & tester
Pick a common pattern or write your own regex, then test it live against sample strings — matches highlighted inline.
/[\w.+-]+@[\w-]+\.[\w.]+/gihello@example.comsupport@devtools.ioAbout this tool
Describe what you want to match in plain English, or provide positive and negative examples, and get a working regular expression instantly. Test it live against sample strings with match highlighting.
- 1
Select a common pattern from the presets (email, URL, IP address, date, etc.) or type your own regex.
- 2
Enter test strings in the Test tab — matching parts are highlighted inline.
- 3
Use the Flags section to toggle global, case-insensitive, and multiline modes.
- 4
Copy the final regex with the Copy button.
Generate an email or phone number validation regex for a form without memorising the pattern.
Test a regex from Stack Overflow against your actual data before adding it to code.
Build a URL or date pattern interactively and verify edge cases instantly.
Extract matches from a log snippet using the live test panel.
Email address/^[\w.+-]+@[\w-]+\.[\w.]+$/iIPv4
IPv4 address/^(\d{1,3}\.){3}\d{1,3}$/No matches found
Cause: The generated or entered regex does not match the test string — the pattern may be too strict.
Fix: Try relaxing the pattern (remove anchors ^ or $), or add more representative positive examples.
Invalid regular expression
Cause: The regex contains a syntax error such as an unescaped special character or unclosed group.
Fix: Check for unbalanced parentheses or brackets. Escape literal dots, slashes, and other special characters with a backslash.
These answers explain common regex gen tasks, expected input formats, and edge cases so both visitors and search engines can understand what this tool does.
What presets are included?
Email, URL, IPv4, IPv6, Date (YYYY-MM-DD, DD/MM/YYYY), Time (HH:MM), Phone (international), Hex colour, Slug, Semantic version, Credit card, UUID, Postal code (US), and Integer / Float.
What flags are supported?
g (global — find all matches), i (case-insensitive), m (multiline — ^ and $ match line boundaries), and s (dotAll — dot matches newline).
Does this use AI to generate regex?
No. Patterns are pre-built, well-tested regular expressions. The tool does not call any AI or external API — everything runs in the browser.
Can I use the output in JavaScript?
Yes. The displayed regex is in JavaScript literal syntax (e.g. /pattern/flags). For other languages, remove the surrounding slashes and pass the flags separately.