Skip to content
epitometool

Regex builder

Regex & strings

Build regex visually from common patterns.

Updated

Category

Patterns

Pattern — Email (basic)

/[^\s@]+@[^\s@]+\.[^\s@]+/g

Loose — accepts non-RFC mail. Validates 99% of real addresses.

No matches yet.

Quick start

How to use the regex pattern library

Pick a category, choose a pattern, test it, then copy the regex or ready-made JS code.

  1. Step 1
    Pick a category

    Web, numbers, dates, strings, code or files — tabs filter the catalog.

  2. Step 2
    Choose a pattern

    Click any card. The detail panel shows the regex with flags and an editable test input.

  3. Step 3
    Copy what you need

    Copy the bare pattern for sed / grep, or 'Copy as JS' for a paste-ready new RegExp constructor.

In-depth guide

Regex pattern library — common patterns ready to copy

Twenty-plus reusable regex patterns across web, numbers, dates, strings, code and files. Click any pattern to see its details, test it against your own input, and copy the regex or a ready-to-paste JavaScript RegExp constructor.

When to use regex (and when not to)

Regex shines at:

  • Extracting structured tokens from messy text (URLs, emails, IPs).
  • Validating format-only correctness (zip codes, phone numbers).
  • Find-and-replace transformations across whole codebases.

Reach for a real parser when:

  • The format has nesting or recursion (HTML, JSON, source code).
  • You need semantic validation (is this DNS-resolvable? does this user exist?).
  • The grammar is published — use the parser library, not a regex.

What's in the library

  • Web — emails, URLs, domains, IPv4 / IPv6, UUIDs.
  • Numbers — integers, decimals, hex, currency amounts.
  • Date/Time — ISO dates and datetimes, 24-hour times.
  • Strings — whole-word matching, whitespace trim, double spaces, blank lines.
  • Code — hex / rgb colors, HTML tags, line and block comments.
  • Files — extensions, Windows and Unix paths.

Validation tips

  • Anchor when validating — wrap with ^…$ to ensure the whole string matches, not just a substring.
  • Drop g when testing existenceregex.test(str) with a sticky g flag has stateful behaviour. For boolean tests, drop g or use String.match.
  • Escape user input — when building a pattern from untrusted data, escape with a helper so special characters don't change the regex's meaning.

Frequently asked questions

Are these patterns tested in real browsers?

Yes — every pattern compiles in V8 (Chrome), JavaScriptCore (Safari) and SpiderMonkey (Firefox). The test pane uses the same RegExp engine that ships in your browser.

Is the email pattern RFC-compliant?

No — the full RFC 5322 email grammar is over 6000 characters and matches nothing real-world programs would want. Our 'basic' email regex catches 99% of valid addresses; for strict validation, send a confirmation email.

Why is the IPv6 pattern so simple?

The 'real' IPv6 regex with compression support (::) is several hundred characters. We provide the simple full form here for sanity-checking; for production parsing use a dedicated library.

How do I copy a pattern into my code?

Click 'Copy pattern' for the raw expression or 'Copy as JS' for a ready-to-paste new RegExp(...) constructor with the right flags.

Can I save my own patterns?

Not yet — this is a curated reference catalog. Use the regex tester tool to build and test your own patterns.

What about lookbehind support?

Modern JavaScript (Chrome 62+, Safari 16.4+, Firefox 78+) supports lookbehind. Older Safari versions throw a syntax error on (?<=...) — our catalog avoids it for portability.

Keep exploring

More tools you'll like

Hand-picked utilities that pair well with the one you're on — all free, client-side, and zero-signup.