3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 22:09:26 +01:00

Use re2 for regfind and factfind

This commit is contained in:
Pragmatic Software 2017-09-09 22:37:11 -07:00
parent 58f21b3bf7
commit 278fffdad6
2 changed files with 2 additions and 0 deletions

View File

@ -1175,6 +1175,7 @@ sub factfind {
$last_chan = ""; $last_chan = "";
$i = 0; $i = 0;
eval { eval {
use re::engine::RE2 -strict => 1;
my $regex = ($arguments =~ m/^\w/) ? '\b' : '\B'; my $regex = ($arguments =~ m/^\w/) ? '\b' : '\B';
$regex .= quotemeta $arguments; $regex .= quotemeta $arguments;
$regex .= ($arguments =~ m/\w$/) ? '\b' : '\B'; $regex .= ($arguments =~ m/\w$/) ? '\b' : '\B';

View File

@ -164,6 +164,7 @@ sub regfind {
$last_section = ""; $last_section = "";
$i = 0; $i = 0;
eval { eval {
use re::engine::RE2 -strict => 1;
foreach my $section_key (sort keys %{ $registry }) { foreach my $section_key (sort keys %{ $registry }) {
next if defined $section and $section_key !~ /^$section$/i; next if defined $section and $section_key !~ /^$section$/i;
foreach my $item_key (sort keys %{ $registry->{$section_key} }) { foreach my $item_key (sort keys %{ $registry->{$section_key} }) {