Text::RewriteRules

Text::RewriteRules Perl module contains a system to rewrite text using regexp-based rules.
Download

Text::RewriteRules Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Alberto Simes and Jos Joo Almeida
  • Publisher web site:
  • http://search.cpan.org/~ambs/Text-RewriteRules-0.10/lib/Text/RewriteRules.pm

Text::RewriteRules Tags


Text::RewriteRules Description

Text::RewriteRules Perl module contains a system to rewrite text using regexp-based rules. Text::RewriteRules Perl module contains a system to rewrite text using regexp-based rules.SYNOPSIS use Text::RewriteRules; RULES email .==> DOT @==> AT ENDRULES email("ambs@cpan.org") # returns ambs AT cpan DOT org RULES/m inc (d+)=e=> $1+1 ENDRULE inc("I saw 11 cats and 23 docs") # returns I saw 12 cats and 24 docsABSTRACTThis module uses a simplified syntax for regexp-based rules for rewriting text. You define a set of rules, and the system applies them until no more rule can be applied.Two variants are provided:traditional rewrite (RULES function): while it is possible do substitute | apply first substitution rule cursor based rewrite (RULES/m function): add a cursor to the begining of the string while not reach end of string | apply substitute just after cursor and advance cursor | or advance cursor if no rule can be appliedA lot of computer science problems can be solved using rewriting rules.Rewriting rules consist of mainly two parts: a regexp (LHS: Left Hand Side) that is matched with the text, and the string to use to substitute the content matched with the regexp (RHS: Right Hand Side).Now, why don't use a simple substitute? Because we want to define a set of rules and match them again and again, until no more regexp of the LHS matches.A point of discussion is the syntax to define this system. A brief discussion shown that some users would prefer a function to receive an hash with the rules, some other, prefer some syntax sugar.The approach used is the last: we use Filter::Simple such that we can add a specific non-perl syntax inside the Perl script. This improves legibility of big rewriting rules sytems.This documentation is divided in two parts: first we will see the reference of the module. Kind of, what it does, with a brief explanation. Follows a tutorial which will be growing through time and releases.Requirements:· Perl Requirements: · Perl


Text::RewriteRules Related Software