newbie regex

Leif K-Brooks eurleif at ecritters.biz
Mon Oct 17 13:11:13 EDT 2005


csselo at gmail.com wrote:
> I want to filter some strings,but i don t know how to use compile
> method.

Why not?

> first character must be [a-zA-z] group and others can only be digits or
> letters.

if re.search('^[a-zA-Z][a-zA-Z0-9]*$', foo):
    print "Valid string."
else:
    print "Invalid string."



More information about the Python-list mailing list