# First, we need to import the Regular Expression library
import re
# We need to grab the value of the text field.
text = self.text
# Here, we put together our regular expression for email addresses.
validAddress = re.compile(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)")
# Check the text against the regular expression.
# If the text does not fit in with the regular expression, it returns a value of None, which we use to show an error box.
if validAddress.match(text) is None:
system.gui.errorBox("Please enter a vaild email address!", "Email Not Valid")