Skip Menu |

This queue is for tickets about the Regexp-Trie CPAN distribution.

Report information
The Basics
Id: 37287
Status: open
Priority: 0/
Queue: Regexp-Trie

People
Owner: Nobody in particular
Requestors: pauloscustodio [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.02
Fixed in: (no value)



Subject: _regexp is useful, should be renamed and documented
I use Regexp::Trie for fast scan of words, but as I need case-insensitive matches, I use the internal undocumented _regexp() method, instead of regexp(). The following code: use Regexp::Trie; my $rt = Regexp::Trie->new; for (qw/foobar fooxar foozap fooza/){ $rt->add($_); } print $rt->regexp, "\n"; print $rt->_regexp, "\n"; Prints: (?-xism:foo(?:bar|xar|zap?)) foo(?:bar|xar|zap?) The problem with regexp() is the "(?-i:" case sensitive flag. What I do in my code is: $re = $rt->_regexp; /$re/i; but I feel guilty of using an internal method. Suggestion: rename _regexp to regexp_string Best regards Paulo Custodio
I'd just like to second this. An alternative approach would be to allow regular expression flags to be passed into the 'regex' method, for example: my $re = $Trie->regexp(); my $case_insensitive_re = $Trie->regexp('i'); Or something along those lines? -------------- On another related note: your docs are a bit outdated. As of Perl 5.12 or so the output of print $rt->regexp, "\n" Is now... (?^:foo(?:bar|xar|zap?)) Not... (?-xism:foo(?:bar|xar|zap?)) ------------------- Thanks! Really great module :-)
FYI I'm working on some patches over at https://github.com/kaoru/Regexp-Trie if you're interested. I forked it from gitpan (https://github.com/gitpan/Regexp-Trie) because I couldn't find you on Github.