Running this script in debug mode after the changes, I received the following error:
"Script error: Expected expression!
$pos=instrrev($line,$string)"