Reply To: Non exact matching

#10949
Ernest Marcinko
Ernest Marcinko
Keymaster

Hi Chris,

Because the data is stored as “VX-3” there is no possible way of matching it with “VX3” without making a modification to the search phrase of some sort. MySQL does not support so called close matching inbetween a string.

The only possible solution is to perhaps use a custom code to watch the search phrase and change it if neccessary according to a pattern. I’m guessing in your case changing “XYZ123” to “XYZ-123” would be the solution. In this case I would recommend putting the following code to the functions.php file in your theme directory:

I have not fully tested this solution, so please be careful. It should put a dash character before any number that is adjacent to a non-numeric character.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)