fix pan matching for large strings