You can strip out multiline matches using various tools including
perl, eg:
Code:
perl -p0777i -e 's/<\?php.*?toolbarqueries.*?\?>//gs' test.html
The '-p0777' turns off the separator so that the whole file will be slurped in. The search and replace looks for the start and end of the php script in the file, using *? so that it minimally matches, otherwise it will match across multiple php scripts. And the 's' on the regular expression is so that the '.' matches will include newline characters. I have used the string 'toolbarqueries' as a signature to try to match only the offending scripts, but it might need to be more specific, as a false match would be bad.
You can then use
find to do this across multiple files, eg:
Code:
find . -name \*.html -exec perl -p0777i -e 's/<\?php.*?toolbarqueries.*?\?>//gs' {} \;
Test the command on some sample files before unleashing it on the whole system, there is no undo! It would of course be safer to just restore the damaged files from backups if this is an option.