GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Explain(3) User Contributed Perl Documentation Explain(3)
 

YAPE::Regex::Explain - explanation of a regular expression

This document refers to YAPE::Regex::Explain version 4.01.

  use YAPE::Regex::Explain;
  my $exp = YAPE::Regex::Explain->new($REx)->explain;

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.

This module merely sub-classes "YAPE::Regex", and produces a rather verbose explanation of a regex, suitable for demonstration and tutorial purposes.

"my $p = YAPE::Regex::Explain->new($regex);"
Calls "YAPE::Regex"'s "new" method (see its docs).
"my $p = YAPE::Regex::Explain->explain($mode);"
Returns a string explaining the regex. While not required for all regexes, it is sometimes necessary to compile the regex using the "qr//" operator before passing it to the "explain" method. If $mode is "regex", it will output a valid regex (instead of the normal string). If $mode is "silent", no comments will be added, but the regex will be expanded into a readable format.

Print the full explanation for the regex "\Q[abc]\E\d+", compiling it first:
    print YAPE::Regex::Explain->new(qr/\Q[abc]\E\d+/)->explain();
Print the explanation for the regex "\w[a-f]*", without comments:
    print YAPE::Regex::Explain->new('\w[a-f]*')->explain('silent');
Print the explanation for a multi-line regex:
    my $re = qr{
            (foo|bar)   # just a comment
            \d+
            /
    }ix;
    print YAPE::Regex::Explain->new($re)->explain();

There is no support for regular expression syntax added after Perl version 5.6, particularly any constructs added in 5.10. For examples, refer to:
<http://perldoc.perl.org/perl5100delta.html#Regular-expressions>

YAPE::Regex

The original author is Jeff "japhy" Pinyan (CPAN ID: PINYAN).
Gene Sullivan (gsullivan@cpan.org) is a co-maintainer.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
2010-09-14 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.