Refactored like/ilike to use a helper function to convert sql pattern into a regex string