Regular Expression: Match with... tolerance

  • Thread starter Thread starter teo
  • Start date Start date
T

teo

Hallo,

I'd like to match a given string, let's say
fghilm
in a bigger string, let's say
abcdefghilmnopq

but I'd like to have also a toleranche, let's say
about 1 chars

so if we have if in the bigger string

one different char, like z in
abcdefghzlmnopq
or
one missing char, like g in
abcdefhilmnopq

the match happens the same.

-------

Does RegEx have this feature
(even better if the tolerance could be customizable,
that is one or two or three chars... of tolerance)?

If not,
any other solution/snippet of code/web page link?
 
I'd like to match a given string, let's say
fghilm
in a bigger string, let's say
abcdefghilmnopq

but I'd like to have also a toleranche, let's say
about 1 chars

so if we have if in the bigger string

one different char, like z in
abcdefghzlmnopq
or
one missing char, like g in
abcdefhilmnopq

the match happens the same.

-------

Does RegEx have this feature
(even better if the tolerance could be customizable,
that is one or two or three chars... of tolerance)?

This sort of "fuzzy" matching can be mimiced with wildcards and the
reptition constructs, but it's a bit kludgy.

Probably best to use full-text searching for this sort of matching. Or
perhaps Soundex matching if it's readable text.
 
Back
Top