[Tutor] Simple reg-ex syntax?

Allen Fowler allen.fowler at yahoo.com
Thu Mar 13 03:59:58 CET 2008


I have code that looks something like:

self.aString = "abc123xyz"
self.theNumber = int(re.search('(\d+)',self.aString).group())

Is there a more Pythonic way of doing this? (Both the reg-ex and the Int coercion.)  How about when I will need to extract more than one substring?

Thank you,

Never miss a thing.  Make Yahoo your home page. 

More information about the Tutor mailing list