Taken from my "HTML to BBCode" script-
Code:
Loop, read, code.txt, outputText1.txt
{
string=%A_LoopReadLine%
loop
{
ifinstring,string, <head>
head=1
ifinstring, string, </head>
head=2
ifinstring,string, <script
script=1
ifinstring,string, </script>
script=2
if head=1
{
StringReplace, string, string, %string%,, All
break
}
if script=1
{
StringReplace, string, string, %string%,, All
break
}
StringGetPos, stringpos1, string, <, L1
StringGetPos, stringpos2, string, >, L1
if stringpos1 = -1
break
if stringpos2 = -1
break
stringpos1+=1
stringpos2+=2
removelength:=stringpos2-stringpos1
if removelength <= 0
break
StringMid, texttoremove, string, %stringpos1%, %removelength%
StringReplace, string, string, %texttoremove%,, All
}
fileappend, %string%`n
}