Re: newbie regex

2005-10-17 Thread Leif K-Brooks
Leif K-Brooks wrote: > [EMAIL PROTECTED] wrote: > >>I want to filter some strings,but i don t know how to use compile >>method. > > Why not? Sorry: I misread that as not _wanting_ to use the compile method. -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie regex

2005-10-17 Thread Leif K-Brooks
[EMAIL PROTECTED] 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 str