DeskKit

Regex library

Regular expression for email addresses

A practical JavaScript regex for email addresses, with live tests. Not a full RFC 5322 parser — and that is intentional.

^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$

Runs 100% in your browser. Nothing you paste is uploaded, stored, or sent to a server.

Flags

Highlighted matches

    How to use

    1. Scan the pre-filled pattern and the sample. Hits are highlighted; misses stay plain.
    2. Toggle flags if you need global or case-insensitive matching. The pattern is JavaScript / ECMAScript.
    3. Paste your own corpus. Nothing is sent to a server.
    4. Read the notes below before you drop the pattern into production — several of these are intentionally incomplete.

    A perfect email regex is a trap. RFC 5322 allows quoted strings and comments that almost no mail server will deliver. This pattern matches the addresses people actually type: local-part, @, domain, and a two-or-more-letter TLD.

    Use it for a first-pass form check, then let the mail API bounce the rest. The tester on this page is pre-filled so you can see a plus-tag and a rejection side by side.

    What this pattern will not do

    Does not allow IP-literal domains or quoted local parts.

    TLD must be at least two letters; numeric TLDs will fail, which is usually what you want.

    For production validation, prefer an HTML email input plus a confirmation mail.

    FAQ

    Why not implement RFC 5322?

    The full grammar is huge and still will not tell you if the mailbox exists. A practical pattern plus a confirmation email is the reliable pair.

    Does +tag addressing work?

    Yes. The local part allows + so grace+news@example.com matches.

    Is the sample text uploaded?

    No. The tester compiles the pattern with the browser’s RegExp engine and stays on the device.

    DeskKit is a static site. Interactive tools require JavaScript.