在 perl 中编译正则表达式时"reg_node overrun"



我正在尝试运行一个定义一些(复杂)正则表达式的脚本:https://github.com/wo/opp-tools/blob/master/rules/Keywords.pm。每当我包含这个模块时,Perl 都会崩溃并显示消息"panic:reg_node 溢出试图在 rules/Keywords.pm 第 60 行发出 51"。这是在 Ubuntu 12.04 上的 Perl v5.14.2 中。任何可能造成这种情况的想法将不胜感激。

更新:这是导致问题的片段。

use strict;
use warnings;
use utf8;
my $re_address_word = qr/b(?:
universit|center|centre|institute?|sciences?|college|research|
avenue|street|philosophy|professor|address|department|
umass
)b/ix;
our $re_publication_word = qr/b(?:
forthcoming|editors?|edited|publishw*|press|volume
tosappearsin|draft|editorw*|reprints?|excerpt|
circulation|cite
)b/ix;
my $re_notitle = qr/
$re_address_word |
$re_publication_word |
b(?:thanks?|
   @|
   [12]d{3}|
   abstract
)/ix;
our $re_title = qr/^
(?!.*$re_notitle?.*)
p{IsAlpha}    
/x;

今天在编译由多个表达式组成的正则表达式时,我遇到了同样的问题。下面的示例说明了生成问题的代码:

    my $cities = qr/(Foo1|Foo2|FooBarss)/;
    ## Solution change ss -> s[s]
    ## my $cities = qr/(Foo1|Foo2|FooBars[s])/;
    my $street = qr/(foo|bar|baz)/;
    $text =~ /$street s+ $cities/;

解决方案是用 s[s] 替换文字 ss,这似乎很随机,我无法挖掘引用来支持它,但它对我有用。

最新更新