I have an autocomplete that has multiple categories with values that matches any set of letters from the users input. Each category value has multiple strings stored in it (see value.application sample data below).
This works fine, but I want it to only match entire words intead of letter combination. How can this be achieved?
Example:
Source Data: "all caller tallest"
User Enters: "all"
Returns: "all caller tallest"
Looking for it to only return: "all"
source: function(request, response) {
var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i"); // match letters in string
response($.grep(SearchList, function(value) {
return matcher.test(value.label) ||
matcher.test(value.value) ||
matcher.test(value.sku) ||
matcher.test(value.application) ||
matcher.test(value.discontinuedproductlist) ||
matcher.test(value.type);
}));
},
As mentioned, each of these values, has multiple strings of words within them.
Example of (value.application) data: "dry wet cold warm hot burned charred dirty clean soiled"