code

code Python verified Free Download devices Cross-platform

code Code Preview

Python
# Email Extraction Regex Patterns
# Copy-paste ready patterns for any language

# Pattern 1: Simple (Loose) - Fast extraction
SIMPLE = r'[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}'

# Pattern 2: Moderate (Recommended) - Balanced
MODERATE = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b'

# Pattern 3: Plus Addressing Support
PLUS_ADDR = r'[A-Za-z0-9._%+-]+\+?[A-Za-z0-9._%-]*@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}'

# Pattern 4: International Domains
INTERNATIONAL = r'[\w.%+-]+@[\w.-]+\.[\w]{2,}'

# Python usage example
import re
text = "Contact us at support@example.com"
emails = re.findall(MODERATE, text)
print(emails)  # ['support@example.com']

# JavaScript usage
# const regex = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b/gi;
# const emails = text.match(regex);

info About This Tool

The Email Extraction Regex Patterns Library provides battle-tested regular expressions for finding and extracting email addresses from any text source. Each pattern is optimized for different use cases and validation levels.

Available Patterns

  • Simple (Loose) - Maximum recall, fastest performance. Best for logs, scraping
  • Moderate - Balanced accuracy and speed. Recommended for most use cases
  • Plus Addressing - Handles Gmail-style user+tag@domain.com format
  • International - Unicode support for non-Latin domains
  • RFC 5322 Strict - Full compliance for strict validation

Language Support

  • Python - re.findall(), re.match()
  • JavaScript - String.match(), RegExp.test()
  • PHP - preg_match_all()
  • Java - Pattern.compile(), Matcher
  • SQL - MySQL REGEXP, PostgreSQL ~
  • Command Line - grep -E, awk, sed

Performance Notes

  • Simple patterns - O(n), 1M+ chars/sec
  • Moderate patterns - O(n), 500K chars/sec
  • RFC 5322 strict - O(n), 50K chars/sec (10x slower)

Pro Tip: For database queries use moderate pattern. For log analysis use simple pattern. For user input validation consider RFC 5322 strict.

download Download Script

Need Full Automation?

Try Postigo for automated email campaigns with AI personalization

rocket_launch Start Free Trial