Regular Expression: Match with... tolerance

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • teo

    #1

    Regular Expression: Match with... tolerance

    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?
  • Spam Catcher

    #2
    Re: Regular Expression: Match with... tolerance

    teo <teo@inwind.itw rote in news:r5k233h91k hj7t1g459fhrntb auu2fbf79@
    4ax.com:
    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.

    Comment

    Working...