Pattern library/Email address regex

Email address regex

Email patterns look simple until you hit plus-tags, subdomains, or country TLDs.

Use the expression below as a practical starting point, then open Forge to tweak flags, test your own corpus, and export to JS or Python.

Expression

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

How to read it

  • [a-zA-Z0-9._%+-]+Local part
  • @Separator
  • [a-zA-Z0-9.-]+\.[a-zA-Z]{2,}Domain + TLD

Sample test

2 match(es)
Contact alice@example.com or bob.smith+dev@acme.co.uk today. Skip not-an-email and the bare @domain.com.

Starter prompt: match email addresses