PHP :: handle typos in the search

I have a field to enter your friend’s name and search for him, to add him as a friend.
The problem is that if you do not know how to spell your name, for example:
Chris instead of Chris , for example.
I think the correct way to do this is to use RegEx, but I don't know how ...

  • How can I handle these types of typos in PHP ?
    (if this is not possible in PHP, then tell me how to do it in jQuery)

+3
source share
2 answers

, . - levenshtein - PHP , levenshtein.

EDIT: , , , PHP: soundex ( , Double Metaphone), metaphone, similar_text.

+6

Regex . , . , , , ..

, hash_map . , : (, ).

+2

Source: https://habr.com/ru/post/1771992/


All Articles