Lazyweb,
Is there a module to debug your regular expression, to compare the target string and an input regular expression one byte by one? It'd be useful if you have an existent code to do a pattern match against a big chunk of string and don't know why it doesn't match.
use Regexp::Debug;
my $string = "abcdefg"; my $regexp = qr/abcefg/; # Notice 'd' is missing
my $result = Regexp::Debug->compare($string, $regexp);
# $result would be an object or a string to # indicate that the regexp stopped matching at 'abc'
Re:re.pm
miyagawa on 2007-10-12T21:02:56
Oh, yes. Perl built-in pragma./me bangs my head to the desk.
Hmm, but the output of use re 'debug' doesn't seem intuitive if it DOESN'T match.Re:re.pm
agent on 2007-10-24T10:20:54
Man, are you looking something like this in Perl 5?
http://agentzh.org/misc/tracer/langs/index.html
It works for unsuccessful matches as well:)
It's a tracer for Perl 6 regexes though;) It's a tool provided by PCR. Hopefully Perl 5 can have something analogous to this.