update pattern string search algorithm