in reply to highlight and line breaks
This is awful, but also a bit clever, if untested:
my $query = 'some text'; my $searchquery = join('\n?', split(//, $query)); $results = s/($searchquery)/highlight($1)/ge; [download]