mercredi 1 décembre 2021

how to remove special characters while fetching the data from the table

i have a table that holds phone numbers in the format of (###)-###-#### and have one seach bar to search the phone numbers,as the data were stored in us format(###)_###-####

and users will enter in ##### format so how to perform search querey that neglects the special characters('(',')','-') while fetching the data from table

my current query is contact = contact.where('contact.phone_number ilike :search', {search: "%#{input_number}%"} )

where input number holds the user entered input ex("123456789")

thanks in advance

Aucun commentaire:

Enregistrer un commentaire