re-engine-TRE

TRE regular expression engine


License
Artistic-1.0-Perl

Documentation

NAME

re::engine::TRE - TRE regular expression engine

VERSION

version 0.09

SYNOPSIS

    use re::engine::TRE max_cost => 1;

    if ("A pearl is a hard object produced..." =~ /\(Perl\)/i) {
        say $1; # "pearl"
    }

DESCRIPTION

Replaces Perl's regex engine in a given lexical scope with POSIX regular expressions provided by the TRE regular expression library. tre-0.8.0 is shipped with this module.

PRAGMA OPTIONS

  • cost_ins: The default cost of an inserted character, that is, an extra character in string (default: 1).
  • cost_del: The default cost of a deleted character, that is, a character missing from string (default: 1).
  • cost_subst: The default cost of a substituted character (default: 1).
  • max_cost: The maximum allowed cost of a match. If this is set to zero, an exact matching is searched for (default: 0).
  • max_ins: Maximum allowed number of inserted characters (default: unspecified).
  • max_del: Maximum allowed number of deleted characters (default: unspecified).
  • max_subst: Maximum allowed number of substituted characters (default: unspecified).
  • max_err: Maximum allowed number of errors (inserts + deletes + substitutes; default: unspecified).

Set any value to -1 to represent "unspecified, but very high".

REFERENCES

Algorithm & Implementation

Salvaged several parts from

AUTHOR

Ævar Arnfjörð Bjarmason <avar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Ævar Arnfjörð Bjarmason.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.