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."