Need some assistance on Regular expression in python

vijay swaminathan swavijay at gmail.com
Wed Apr 18 14:36:49 EDT 2012


Hi Experts,


I'm a new bie to python and need some assistance in the usage of regular
expression.

I have a string something like this:

New builds available Version: 20120418-abcdef-1 (based on SDK 0.0.0.1)

from the above string I want to extract the following text using regular
expression

20120418-abcdef-1
0.0.0.1

I can do this by split but I feel it is an ineffective way of doing this. I
tried using regular expression but could not narrow down.

for example, I used

    sdk_version = re.search(r"SDK(.*)", lines,)
                        print sdk_version.group(1)

but this gave the version 0.0.0.1) along with the paranthesis I did not
know how to elimate ')' .. Need some help here..

Thanks
-Vijay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120419/8f6c50e5/attachment.html>


More information about the Python-list mailing list