The locate() function finds the location of one string within another. It returns 0 when it doesn't find an exact, case sensitive match; otherwise, it returns the character position of the first match. The first character is position 1.
The substring() function returns a string out of another string starting at a specific character position for the specified number of bytes up to the end of the string. The first character is position 1.
The right() function returns a string out of another string starting at the end for the specified number of bytes up to the beginning.
The left() function returns a string out of another string starting at the beginning for the specified number of bytes up to the end.
TIP: A match can be made case insensitive by wrapping the field name in the lower() function and comparing it to a lower case string constant:
"locate( lower(favoriteSaying), \"there\" ) == 1"
Include records where the "favoriteSaying" field contains "there". Matches include "There is no 'i' in team but there is in win." and "Once something is a passion, the motivation is there.".
"locate( favoriteSaying, \"there\" ) >= 1"
Include records where the "favoriteSaying" field does not contain "is". Matches include "Every strike brings me closer to the next home run." and "Float like a butterfly, sting like a bee.".
"locate( favoriteSaying, \"is\" ) == 0"
Include records where "favoriteSaying" field contains "there" after the first 10 bytes. Matches include "There is no 'i' in team but there is in win.".
"locate( favoriteSaying, \"there\", 10 ) >= 10"
Include records where the first 3 characters in a "name" field match the string "Muh". Matches include "Muhammad Ali".
"left(name, 3) == \"Muh\""
Include records where the first 3 characters in a "name" field do not match the string "Muh". Matches include strings like "Babe Ruth", "Pele", and "Wayne Gretzky", but not "Muhammad Ali".
"left(name, 3) != \"Muh\""
Include records where the 3 rightmost characters in a "name" field match the string "Ali". Matches include strings like "Babe Ruth", "Pele", and "Wayne Gretzky", but not "Muhammad Ali".
"right(name,3) == \"Ali\""
Include records where the 3 rightmost characters in a "name" field do not match the string "Ali". Matches include strings like "Babe Ruth", "Pele", and "Wayne Gretzky", but not "Muhammad Ali".
"right(name,3) != \"Ali\""
Include records where the 3rd and 4th characters in a "name" field match the string "ch". Matches include strings like "Michael Jordan" and "Michael Schumacher".
"substring(name,3,2) == \"ch\""
Include records where the 3rd and 4th characters in a "name" field do not match the string "ch". Matches include strings like "Michael Jordan" and "Michael Schumacher".
"substring(name,3,2) != \"ch\""