python regular expression
Peter Hansen
peter at engcorp.com
Fri Nov 21 18:59:47 EST 2003
eddieNOSPAM at eddiecentral.net 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'
try:
shortStuff = stuff[stuff.index('<HTML>'):]
except:
shortStuff = stuff
No regex required...
More information about the Python-list
mailing list