Simple Python REGEX Question
Gary Herron
gherron at islandtraining.com
Fri May 11 12:21:59 EDT 2007
johnny wrote:
> I need to get the content inside the bracket.
>
> eg. some characters before bracket (3.12345).
>
> I need to get whatever inside the (), in this case 3.12345.
>
> How do you do this with python regular expression?
>
>>> import re
>>> x = re.search("[0-9.]+", "(3.12345)")
>>> print x.group(0)
3.12345
There's a lot more to the re module, of course. I'd suggest reading the
manual, but this should get you started.
Gary Herron
More information about the Python-list
mailing list