sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #06581
Re: [Question #177366]: How can we validate email id in Sikuli tool
Question #177366 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/177366
Status: Open => Answered
RaiMan proposed the following answer:
ok, here you are:
import re
test_email =re.compile('^([a-zA-Z0-9_.-]+)\@([a-zA-Z0-9-]+\.[a-zA-Z0-9]{2,4})$')
m = re.match(test_email, "r.ho@xxxxx")
print m.groups()
prints:
('r.ho', 'x.com')
*** comments
-- re.compile needs a string (so do not enclose the regex in / )
-- characters inside [ ] need not be escaped with \ (only the ] if needed)
-- if you do not need the matched content afterwards, the regex does not need any ( ):
test_email =re.compile('^[a-zA-Z0-9_.-]+\@[a-zA-Z0-9-]+\.[a-zA-Z0-9]{2,4}$')
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.