Skip to content
SmaftyTools

Regex Generator

Get battle-tested regular expressions for emails, URLs, IPs, dates, passwords and more — with flags and anchoring options, ready to copy.

Practical email matcher covering the vast majority of real addresses.

Regular expression

/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/

Example match: name@example.com

Tip: test and tweak this pattern in our Regex Tester.

About Regex Generator

The Regex Generator gives you proven regular expressions for the patterns developers actually need — email addresses, URLs, IPv4 addresses, ISO dates, times, hex colors, UUIDs, slugs, usernames, numbers, strong passwords and HTML tags.

Each pattern comes with a description and example match. Toggle anchoring (^…$) for whole-string validation and the g/i/m flags for your use case, and the ready-to-copy literal updates instantly.

It's faster and safer than hand-writing (or guessing at) common patterns — these are curated, tested expressions that avoid the classic pitfalls like unescaped dots and catastrophic backtracking.

How to Use the Regex Generator

  1. Pick what you want to match from the dropdown.
  2. Toggle anchoring and flags to suit validation vs. searching.
  3. Copy the regex literal and paste it into your code.
  4. Fine-tune or test it further in our Regex Tester.

Features

  • 14 curated patterns for common validation tasks
  • Anchoring and g/i/m flag options
  • Description and example for every pattern
  • One-click copy of the complete literal

Frequently Asked Questions

When should I anchor a regex?

Anchor with ^ and $ when validating that an entire input is the pattern (like a form field). Leave it unanchored when searching for the pattern inside larger text.

Is the email regex 100% RFC-compliant?

No practical regex is — full RFC 5322 is famously unmatchable. This pattern matches the overwhelming majority of real-world addresses, which is what form validation needs; the definitive check is sending a confirmation email.

Is the Regex Generator free?

Yes, the Regex Generator is completely free with no usage limits. No signup, no account and no installation required.

Does the Regex Generator work on mobile?

Yes. The Regex Generator is fully responsive and works in any modern browser on phones, tablets and desktops.