OK – here's minimal test case. It contains error in first filename, but the core was triggered anyway, in each run of two that I've done. Two files, input1.txt, input2.txt, with the problematic strings, then: MATCH="" buf="${buf#(#m)$word}" in test.zsh Best regards, Sebastian Gniazdowski