regex to exctract informations

Colin Gillespie c.gillespie at ncl.ac.uk
Fri May 5 08:35:30 EDT 2006


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



More information about the Python-list mailing list