Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
import re email_pattern = re.compile(r""" [\w.+-]+ # username @ # at sign [\w-]+ # domain name (?:\.[\w-]+)* # subdomains \.\w{2,4} # TLD """, re.VERBOSE) print(bool(email_pattern.match("user@example.com"))) # True
Result
Open