Regexp::Parser 0.20 review

Download
by rbytes.net on

Regexp::Parser is a Perl module for parsing regexes. This module parses regular expressions (regexes)

License: Perl Artistic License
File size: 39K
Developer: Jeff Pinyan
0 stars award from rbytes.net

Regexp::Parser is a Perl module for parsing regexes.

This module parses regular expressions (regexes). Its default "grammar" is Perl 5.8.4's regex set. Grammar is quoted because the module does not so much define a grammar as let each matched node state what it expects to match next, but there is not currently a way of extracting a complete grammar. This may change in future versions.

This module is designed as a replacement (though not drop-in) for my old YAPE::Regex modules.

USAGE:

Creating an Instance

To use this module as is, load it, and create an instance:

use Regexp::Parser;
my $parser = Regexp::Parser->new;

Setting a Regex

To have the parser work on a specific regex, you can do use any of the following methods:

$parser = Regexp::Parser->new($regex)

You can send the regex to be parsed as the argument to the constructor.

$parser->regex($regex)

Clears the parser's memory and sets $regex as the regex to be parsed.

These two approaches do an initial pass over the regex to make sure it is well-formed -- any warnings or errors will be determined during this initial pass.

Requirements:
Perl

Regexp::Parser 0.20 keywords