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

Jay Dorsey jay at jaydorsey.com
Thu Oct 2 11:27:52 EDT 2003


Jay Dorsey wrote:

>  >>> regex = re.compile('[a-z]|[A-Z]')
>  >>> regex.findall('123a23423b13123c123123A123B123C')
> ['a', 'b', 'c', 'A', 'B', 'C']
> 

Line 1 above should have been [a-zA-Z] (although as posted it works as 
well).  Its just prettier the second way :-)

Jay






More information about the Python-list mailing list