A
A
anamorph2017-05-13 15:46:05
JavaScript
anamorph, 2017-05-13 15:46:05

How to set an error of one character per line?

Is there any pattern for searching in the form of a string. For example, let's take the string "elephant". It is
necessary to make it so that if the words "sloon" or "clone", etc., are in the database, with an error of one character, they are also displayed.
Can this be done through regular expressions or something else?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
anamorph, 2017-06-19
@anamorph

the solution was to include the library
https://www.npmjs.com/package/levenshtein-edit-distance

A
Anvar Shakhmaev, 2017-05-13
@RxR

Levenshtein algorithm, example usage:
https://jsfiddle.net/fL4vak4u/1/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question