Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
YAPE::Regex::解释不使用use 5.014;_Regex_Perl - Fatal编程技术网

YAPE::Regex::解释不使用use 5.014;

YAPE::Regex::解释不使用use 5.014;,regex,perl,Regex,Perl,此代码: use strict; use warnings; use YAPE::Regex::Explain; print YAPE::Regex::Explain->new( qr/d+/ )->explain(); 印刷品 The regular expression: (?-imsx:d+) matches as follows: NODE EXPLANATION --------------------------------

此代码:

use strict;
use warnings;
use YAPE::Regex::Explain;
print YAPE::Regex::Explain->new( qr/d+/ )->explain();
印刷品

The regular expression:

(?-imsx:d+)

matches as follows:

NODE                     EXPLANATION
----------------------------------------------------------------------
(?-imsx:                 group, but do not capture (case-sensitive)
                         (with ^ and $ matching normally) (with . not
                         matching \n) (matching whitespace and #
                         normally):
----------------------------------------------------------------------
  d+                       'd' (1 or more times (matching the most
                           amount possible))
----------------------------------------------------------------------
)                        end of grouping
----------------------------------------------------------------------
但是这个代码

use 5.014;  #added this
use strict;
use warnings;
use YAPE::Regex::Explain;
print YAPE::Regex::Explain->new( qr/d+/ )->explain();
仅打印:

The regular expression:



matches as follows:

NODE                     EXPLANATION
----------------------------------------------------------------------

怎么了?

功能
unicode\u字符串
更改了创建的模式

$ perl -le'no  feature qw( unicode_strings ); print qr/\d+/'
(?^:\d+)

$ perl -le'use feature qw( unicode_strings ); print qr/\d+/'
(?^u:\d+)
由于缺乏维护,无法处理许多新功能(而且不是很新)。这在“限制”一节中有记录

我打赌它使用
re::regexp_模式
(解释为什么它显示
(?-imsx:d+
)而不是
(?^:\d+
)来获取标志,并阻塞它不知道的“
u
”标志

$ perl -le'no  feature qw( unicode_strings ); print +(re::regexp_pattern(qr/\d+/))[1]'


$ perl -le'use feature qw( unicode_strings ); print +(re::regexp_pattern(qr/\d+/))[1]'
u

我没有一个实际的答案,但你试过了吗?似乎是最好的答案。使用
功能“unicode_字符串”时,您会得到相同的行为