Does anyone know a good algorithm to search a string on whole words only. For example, look for order and not order_line in a query.
This could be an useful addition to code search.
Does anyone know a good algorithm to search a string on whole words only. For example, look for order and not order_line in a query.
This could be an useful addition to code search.
Best answer by Jasper
Something like this should work:
where '.' + column_to_search + '.'
like '%[^a-z_]search_term[^a-z_]%'
This query adds a period before the column to take into account situations where the word is at the beginning or end, and then checks if the word is enclosed by characters other than a to z or underscore.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.