in reply to Re: Fuzzy Matching
in thread Fuzzy Matching

Would that allow me to get a count of how many errors had been introduced, though?

Replies are listed 'Best First'.
Re3: Fuzzy Matching
by dragonchild (Archbishop) on Aug 26, 2003 at 18:32 UTC
    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.