A string-searching algorithm, sometimes called string-matching algorithm,[1] is an algorithm that searches a body of text for portions that match by pattern.