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:

Continue reading “Python Regex”