Regular Expression Hell?
Akira Kiyomiya
akira.kiyomiya at autodesk.com
Mon May 8 17:58:13 EDT 2000
Okay, these two regular expression codes are from Python Essential Reference
book and I am pretty confused about these.
Could someone dare to explan step by step?
e_mail = re.compile(r'([a-zA-Z][\w-]*@[\w-]+(?:\.[w-]+)*)')
# I know [a-zA-Z] any lower or upper word.....[\w-]?? any alphabetical
character?? what is "-" after "\w"?
# I know @, you need it for the e-mail.... Then, I am lost....
URL = re.compile(r'((ftp | http)://[\w-]+(?:\.[\w-]+)*(?:/[\w-]*)*)')
# I know ftp or http part plus "://" you need it for URL. Then,..... I am
lost....
Akira
More information about the Python-list
mailing list