Hello folks :

i have a string "-bin-ulockmgr_server:0.99[&&NHX:C=0.195.0]" from which i
want to delete [&&NHX:C=0.195.0] .
I wrote a regular expression for [&&NHX:C=0.195.0] as
\[&&(\w)+:\w=((-)?(\d|\d\d|\d\d\d)\.)+\d\]

now when i do

p = re.compile('\[&&(\w)+:\w=((-)?(\d|\d\d|\d\d\d)\.)+\d\]')
m =p.search("-bin-ulockmgr_server:0.99[&&NHX:C=0.195.0]")
print m
<_sre.SRE_Match object at 0x01314EE8>
>>> print m.group()
[&&NHX:C=0.195.0]

So i guess i am able to find the substring , my question is how can i delete
this substring from the original string? ie
-bin-ulockmgr_server:0.99 should be my output.

thanks

Aditya
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to