The ANCHOR modifier is used with the LEVENSHTEIN routine. This modifier finds a match of one string (String 1) within another string (String 2) by making a SUBSTRNG-like comparison from the beginning or the end of String 2.
Syntax
ANCHOR (m,n)
where
- m = 1 or 0 . This indicates that the search begins at the beginning of the string. 1 is on, 0 is off. Default is 1.
- n = 1 or 0. This indicates that the search begins at the end of the string. 1 is on, 0 is off. Default is 1.
Acceptable Values
ANCHOR(0,0) - Off for the beginning and the end of the string.
ANCHOR(1,0) - On for the beginning of the string.
ANCHOR(0,1) - On for the end of the string.
ANCHOR(1,1) - On for the beginning and the end of the string. This is equivalent to the LEVENSHTEIN routine without using the ANCHOR modifier. Default.
Example 1
ANCHOR (1,0)
String 1 - BELA
String 2 - ISABELA
The routine searches for the string "BELA" in "ISABELA" by anchoring the search at the beginning of the string and finds it after skipping over 3 characters. Therefore the edit distance is 3 and the score is 99-3=96.
Example 2
ANCHOR (0,1)
String 1 - BELA
String 2 - ISABELA
The routine searches for the string "BELA" in "ISABELA" by anchoring the search at the end of the string and finds it at the end. Therefore the edit distance is 0 and the score is 99-0=99.