Bob wrote: > Dears, > > I am trying to search and replace strings with regex. > > The string is identified by a keyword : > > IDImage("1M234567"); > DescriptionImage("Desc of the Image 1"); > > I want to exctract the IDImage (1M234567 ) and the Description. > > The ID are characters and numbers, the description too. > > Thx, > > Bertrand If the string is always in IDImage("#####");
Then what about x='IDImage("#####");' print x[9:-3] Likewise for the Description. HTH Colin -- http://mail.python.org/mailman/listinfo/python-list