I have some records in database that are containing Serbian latin letters (ć, č, đ, ž, š).
I’ve done search functionality in backend (nestjs) to search all columns in table that contain typed characters on frontend (react).
How could I search these latin letters when typed character is for example c (this should look for all 3 characters with same "base" -> c, č, ć). Same should be done with the others.
I tried some regex, but never got desired result.
Any basic ideas how should I do this?
3
Answers
Since you have a
postgres
tag, this can be done using SIMILARYou only need to construct your right part, inside
%%
so as to include these variationsyou can do something like this
You can probably utilize
localCompare
for this.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare
An example:
A
0
indicates that both strings are equivalent.