logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Regexp::Trie - builds trie-ized regexp

Author

       Dan Kogai, <dankogai@dan.co.jp>

Description

       This module is a faster but simpler version of Regexp::Assemble or Regexp::Optimizer.  It builds a trie-
       ized regexp as above.

       This module is faster than Regexp::Assemble but you can only add literals.  "a+b" is treated as "a\+b",
       not "more than one a's followed by b".

       I wrote this module because I needed something faster than Regexp::Assemble and Regexp::Optimizer.  If
       you need more minute control, use those instead.

Name

       Regexp::Trie - builds trie-ized regexp

See Also

       Regexp::Optimizer,  Regexp::Assemble, Regex::PreSuf

Synopsis

         use Regexp::Trie;
         my $rt = Regexp::Trie->new;
         for (qw/foobar fooxar foozap fooza/){
           $rt->add($_);
         }
         print $rt->regexp, "\n" # (?-xism:foo(?:bar|xar|zap?))

Tips

       See t/dict2rx.pl to find how to convert a big dictionary into a single regexp that can be later loaded
       as:

         my $rx = do 'dict.rx';

   EXPORT
       None.

See Also