How To Check For [a-z] In String?

Jay Dorsey jay at jaydorsey.com
Thu Oct 2 11:21:30 EDT 2003


Hank Kingwood wrote:
> Also, how would I check if [a-z] is not in a string?

following my re examples:

 >>> import re
 >>> regex = re.compile('[^a-z]')
 >>> if regex.search('123123123132'): print "no lower letters!"
...
no lower letters!

There is a good regular expression tutorial on 
http://www.amk.ca/python/howto/regex/

jay






More information about the Python-list mailing list