Python Regex

Python library re can be used to search for regular expressions.

import re

Create a new pattern object with re.compile:

# match anything before at least one @ symbol,
# and at least one . after that.
emailpattern = re.compile("[^@]+@[^@]+.[^@]+")

Match against your text object or string literal with sub-object of re.compile() type .match:

if emailpattern.match(""):
# match
# no match

r.I and r.IGNORECASE can be used to modify the pattern object:

pattern = re.compile("this", re.I)
pattern.match("This will match.")