The Resembles operator (also known as Rizz operator) is used to check whether a string almost contains another string. It does not use any wildcard characters. At first glance it works like the Like operator.
Lack of percent signs in the pattern is not the only difference. The Resembles operator checks whether a text contains another text, but is very forgiving. It ignores letter case, diacritical and combining marks. In addition, it treats every character ß like ss, every æ like ae and every œ like oe. From the point of view of this operator, strings manana and MAÑANA are exactly identical.
The most important feature of the Resembles operator is its acceptance of spelling mistakes. It can tolerate at most 1 mistake for every 3 characters in the pattern (second argument). What is a mistake? The rules are the same as used in the Damerau-Levenshtein distance algorithm. Deletion of a character, an insertion, a wrong character or a transposition between two successive symbols.
Let us consider this code.
There are 6 characters in this pattern, so we can tolerate 2 mistakes. When we run it, all files below are selected.
13 movie AVATra FULL HD.mp4 |
movie eVATra D.mp4 |
movie AVVVATar FULL HD.mp4 |
movie Avatar FULL HD.mp4 |
movie ÁvAÁr FULL HD.avi |
movie ÁvTÁrd FULL HD.avi |
Ávat r FULL HD.avi |
FULL HD AVATA.avi |