YAPE::Regex::Element contains sub-classes for YAPE::Regex elements.
SYNOPSIS
use YAPE::Regex 'MyExt::Mod';
# this sets up inheritence in MyExt::Mod
# see YAPE::Regex documentation
YAPE MODULES
The YAPE hierarchy of modules is an attempt at a unified means of parsing and extracting content. It attempts to maintain a generic interface, to promote simplicity and reusability. The API is powerful, yet simple. The modules do tokenization (which can be intercepted) and build trees, so that extraction of specific nodes is doable.
Methods for YAPE::Regex::Element
This class contains fallback methods for the other classes.
my $str = $obj->text;
Returns a string representation of the content of the regex node itself, not any nodes contained in it. This is undef for non-text nodes.
my $str = $obj->string;
Returns a string representation of the regex node itself, not any nodes contained in it.
my $str = $obj->fullstring;
Returns a string representation of the regex node, including any nodes contained in it.
my $quant = $obj->quant;
Returns a string with the quantity, and a ? if the node is non-greedy. The quantity is one of *, +, ?, {M,N}, or an empty string.
my $ng = $obj->ngreed;
Returns a ? if the node is non-greedy, and an empty string otherwise.
Methods for YAPE::Regex::anchor
This class represents anchors. Objects have the following methods:
my $anchor = YAPE::Regex::anchor->new($type,$q,$ng);
Creates a YAPE::Regex::anchor object. Takes three arguments: the anchor (^, A, $, Z, z, B, b, or G), the quantity, and the non-greedy flag. The quantity should be an empty string.
my $anc = YAPE::Regex::anchor->new('A', '', '?');
# /A?/
my $type = $anchor->type;
Returns the string anchor.
Methods for YAPE::Regex::macro
This class represents character-class macros. Objects have the following methods:
my $macro = YAPE::Regex::macro->new($type,$q,$ng);
Creates a YAPE::Regex::macro object. Takes three arguments: the macro (w, W, d, D, s, or S), the quantity, and the non-greedy flag.
my $macro = YAPE::Regex::macro->new('s', '{3,5}');
# /s{3,5}/
my $text = $macro->text;
Returns the macro.
print $macro->text; # 's'
my $type = $macro->type;
Returns the string macro.
Methods for YAPE::Regex::oct
This class represents octal escapes. Objects have the following methods:
my $oct = YAPE::Regex::oct->new($type,$q,$ng);
Creates a YAPE::Regex::oct object. Takes three arguments: the octal number (as a string), the quantity, and the non-greedy flag.
my $oct = YAPE::Regex::oct->new('040');
# / 40/
my $text = $oct->text;
Returns the octal escape.
print $oct->text; # ' 40'
my $type = $oct->type;
Returns the string oct.
Methods for YAPE::Regex::hex
This class represents hexadecimal escapes. Objects have the following methods:
my $hex = YAPE::Regex::hex->new($type,$q,$ng);
Creates a YAPE::Regex::hex object. Takes three arguments: the hexadecimal number (as a string), the quantity, and the non-greedy flag.
my $hex = YAPE::Regex::hex->new('20','{2,}');
# /x20{2,}/
my $text = $hex->text;
Returns the hexadecimal escape.
print $hex->text; # 'x20'
my $type = $hex->type;
Returns the string hex.
Methods for YAPE::Regex::utf8hex
This class represents UTF hexadecimal escapes. Objects have the following methods:
my $hex = YAPE::Regex::utf8hex->new($type,$q,$ng);
Creates a YAPE::Regex::utf8hex object. Takes three arguments: the hexadecimal number (as a string), the quantity, and the non-greedy flag.
my $utf8hex = YAPE::Regex::utf8hex->new('beef','{0,4}');
# /x{beef}{2,}/
my $text = $utf8hex->text;
Returns the hexadecimal escape.
print $utf8hex->text; # 'x{beef}'
my $type = $utf8hex->type;
Returns the string utf8hex.
Methods for YAPE::Regex::backref
This class represents back-references. Objects have the following methods:
my $bref = YAPE::Regex::bref->new($type,$q,$ng);
Creates a YAPE::Regex::bref object. Takes three arguments: the number of the back-reference, the quantity, and the non-greedy flag.
my $bref = YAPE::Regex::bref->new(2,'','?');
# /2?/
my $text = $bref->text;
Returns the backescape.
print $bref->text; # '2'
my $type = $bref->type;
Returns the string backref.
Methods for YAPE::Regex::ctrl
This class represents control character escapes. Objects have the following methods:
my $ctrl = YAPE::Regex::ctrl->new($type,$q,$ng);
Creates a YAPE::Regex::ctrl object. Takes three arguments: the control character, the quantity, and the non-greedy flag.
my $ctrl = YAPE::Regex::ctrl->new('M');
# /cM/
my $text = $ctrl->text;
Returns the control character escape.
print $ctrl->text; # 'cM'
my $type = $ctrl->type;
Returns the string ctrl.
Methods for YAPE::Regex::named
This class represents named characters. Objects have the following methods:
my $ctrl = YAPE::Regex::named->new($type,$q,$ng);
Creates a YAPE::Regex::named object. Takes three arguments: the name of the character, the quantity, and the non-greedy flag.
my $named = YAPE::Regex::named->new('GREEK SMALL LETTER BETA');
# /N{GREEK SMALL LETTER BETA}/
my $text = $named->text;
Returns the character escape text.
print $named->text; # 'N{GREEK SMALL LETTER BETA}'
my $type = $named->type;
Returns the string named.
Requirements:
· Perl
Product's homepage
Requirements:
· Perl