REGEX corresponds to 100% certainty, approximately 99%?

in my application, the user can enter text, which I then search and extract based on a future view.

The problem is that users can sometimes have a type or forget a period, etc.

is there any way in ruby ​​to say coincidence with a confidence level of X%?

Meaning if the match target is 500 characters, and a match was found with 490 characters, match with it, or something doesn't match?

thanks

+4
source share
4 answers

In this case, regular expressions are not your best tool. Maybe something like Levenshtein distance instead?

+8
source

I recently read about the Tre library, it looks like you are looking for:

http://laurikari.net/tre/

+6
source

Adding string distance to the tools: amatch http://flori.github.com/amatch/ This one has several string distance algorithms, and they are written in C. It is very fast.

+3
source

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


All Articles