To perform an approximate text search, we use the routine
ApproxSearchString(pattern : name, target : name, tol : posint)
where pattern is the pattern we are searching for, target is the body of text to be searched and tol is the positive integer representing the number of mismatches between the pattern and the target allowed. Note that spaces are counted as mismatches and the function is case insensitive (hello is equivalent to HeLlO). Like SearchString, if the pattern is found in the target, the function returns the offset of the character directly before where target was found in pattern. If it is not found (within the tolerance tol), the value -1 is returned.
> ApproxSearchString('hallo', 'AAAAAAAAHeLLoBBBBB', 1); 8 > ApproxSearchString('any', 'jdkfajdsjfjasdjkjadfj', 3); 0 # any match is okay > ApproxSearchString('nothing', 'N.O.T.H.I.N.G.', 4); -1