in reply to Re: Highlight a substring
in thread Highlight a substring

That should be
while ($index >= 0) {
and not
while ($index > 0) {