in reply to Fuzzy Matching

Use a lot of ?'s?

------
We are the carpenters and bricklayers of the Information Age.

The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Replies are listed 'Best First'.
Re: Re: Fuzzy Matching
by Anonymous Monk on Aug 26, 2003 at 17:56 UTC
    Would that allow me to get a count of how many errors had been introduced, though?
      Untested:
      my $string = "abcd-ef1"; my @matches = $string =~ /^(\w{2})?(\d)?(\w{2})?(-)?(\w{2})?(\d)?$/; my $errors = grep { !defined $_ } @matches; print "Errors is $errors\n"; ---- Errors is 1

      Basically, you're expecting everything to match. If it doesn't, then non-matches are errors. You'll have to fiddle with it, I think, to get it to do exactly what you want, but that should give you a good start. (This is, of course, that you have to (re)invent the wheel.)

      ------
      We are the carpenters and bricklayers of the Information Age.

      The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

      Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.