[Python-bugs-list] [Bug #111705] problems with re.py and regex.py

noreply@sourceforge.net noreply@sourceforge.net
Fri, 11 Aug 2000 12:19:02 -0700


Bug #111705, was updated on 2000-Aug-11 12:19
Here is a current snapshot of the bug.

Project: Python
Category: None
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Summary: problems with re.py and regex.py

Details: Hi, here is something I have been working on for quite some time. I always thought it was my regex syntax, but I was incorrect. I tried it in perl, and php, and both worked fine.

re.py has a problem with ([_a-zA-Z0-9-]\.*) where it hangs during compilation.
regex.py has a problem with ([a-zA-Z]){2,3} (or any other similar statement) where it does not limit the number of characters properly.

Here is the code
...
import string
import sys
import regex

def testemailaddr(emailaddr):
	pattern = regex.compile('^([_a-zA-Z0-9-]\.*){3,255}@([_a-zA-Z0-9-]\.*){3,255}\.([a-zA-Z]){2,3}$')
	if pattern.match(emailaddr) != None:
		valid = [1, emailaddr]
	else:
		valid = [0, emailaddr]
	return valid

validemail = testemailaddr(sys.argv[1])
if validemail[0] == 1: print validemail[1], "is valid."
else: print validemail[1], "is not valid."

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=111705&group_id=5470