Validation
Email Local Part (Before @)
Validate just the local part of an email address (the bit before the @).
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
^[a-zA-Z0-9._%+\-]{1,64}$Raw source: ^[a-zA-Z0-9._%+\-]{1,64}$
How it works
^ and $ anchor to the full string. [a-zA-Z0-9._%+\-] is the conservative local-part character set (dots, underscores, percent, plus, hyphen for sub-addressing). {1,64} enforces the RFC max length for the local part.
Examples
Input
john.doeMatches
john.doe
Input
user+tagMatches
user+tag
Input
has spaceNo match
—Common use cases
- •Validating partial email input as the user types
- •Splitting and re-assembling email addresses
- •Sub-address (plus-tag) handling in mail systems
- •Form-by-form local-part-only collection