Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: non-exact regexp matches

by McMahon (Chaplain)
on Jun 23, 2004 at 14:44 UTC ( #369050=note: print w/ replies, xml ) Need Help??

in reply to non-exact regexp matches

string-approx might get you there.
Maybe also levenshtein

I haven't tried these, but I've been reading about them recently.

Comment on Re: non-exact regexp matches
Re^2: non-exact regexp matches
by Anonymous Monk on Jun 23, 2004 at 14:51 UTC
    Thanks ! These are pretty cool (I could see come use for them in my work), but I'm looking for something which I could use a regexp:
    $str = "PolarBear"; $str =~ /[Pp]olar[Bb]e[ae]r/;
    if $str is "polarbear" or "polarbeer" or "Polarbear" returns 0
    if $str is "PolarBeat returns 1
    if $str is "PelarBeat returns 2
      Ah, I see. (Also didn't realize that String::Approx doesn't use regexes)

      So this is crazy, but it just might work: stick each letter of one string into one array, then each letter of the other string into the other array. Then use List::Compare to figure out how the two strings are different.

      List::Compare is my favorite hammer these days. =)
        cool. This seems like a generalized way to go about it. Hope the performance is ok. I need to compare a 27 character reg-exp to a 1 million character string ! vince

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://369050]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2015-03-30 02:50 GMT
Find Nodes?
    Voting Booth?

    When putting a smiley right before a closing parenthesis, do you:

    Results (633 votes), past polls