More Regexp help please.

SA sarmstrong13 at mac.com
Tue Aug 13 05:43:41 CEST 2002


On 8/12/02 10:27 AM, in article 1029208615.592822 at ampungk.ozonline.com.au,
"John La Rooy" <igetenoughspamalreadythanksjlr at doctor.com> wrote:
> This should get you started
> 
> re.sub("\?(\d+).htm","\\1.html","?1234.htm")
> 
> \?    matches the ?
> (\d+) matches 1 or more digits and is substituted for the \\1
> 
> John
> 
Thank you for the quick start.

One last question can I substitute "?1234.htm" with a string called 'text'?
The 'text' string contains the contents of an html file that has many links
like ?1234.htm?

Thanks.
SA




More information about the Python-list mailing list