If we pass the search text directly as entered by user to FileMaker API function while searching, then the search will support the wildcard characters like *, @ etc by default. So to disable the wildcard characters always escape the wildcard characters before using them in the search text and for exact match pass the search text as quoted text and append “==” before the search text
|
The following function can be used to the search text before passing it to FileMaker API function to disable wildcard characters: |
function fmEscape($text, $quoted = false) { $escape_chars = '/([@*#?!=<>"])/'; $text = preg_replace($escape_chars,'\\\${1}',$text); if($quoted) { return '"'.$text.'"'; }else{ return $text; } }
This is very useful for the username and password search in login process validation.
|