python regular expression

Peter Hansen peter at
Sat Nov 22 00:59:47 CET 2003

eddieNOSPAM at wrote:
> I am trying to edit a bunch of files that are similar. I want to remove all
> the ASP code that appears before the <HTML> tag. Can some one help me with a
> regex that can replace everything before the <HTML> tag with nothing?

stuff = 'whatever ASP blah\nblah <HTML>more blah blah</HTML>maybe even more'
    shortStuff = stuff[stuff.index('<HTML>'):]
    shortStuff = stuff

No regex required...

More information about the Python-list mailing list