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

jm6*_*666 8 regex perl

这段代码:

use strict;
use warnings;
use YAPE::Regex::Explain;
print YAPE::Regex::Explain->new( qr/d+/ )->explain();
Run Code Online (Sandbox Code Playgroud)

版画

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
----------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)

但这段代码

use 5.014;  #added this
use strict;
use warnings;
use YAPE::Regex::Explain;
print YAPE::Regex::Explain->new( qr/d+/ )->explain();
Run Code Online (Sandbox Code Playgroud)

仅打印:

The regular expression:



matches as follows:

NODE                     EXPLANATION
----------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)

怎么了?

ike*_*ami 7

功能unicode_strings更改创建了哪种模式.

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

$ perl -le'use feature qw( unicode_strings ); print qr/\d+/'
(?^u:\d+)
Run Code Online (Sandbox Code Playgroud)

由于缺乏维护,YAPE :: Regex :: Explain无法处理许多新功能(而非新功能).这在"限制"部分中有记录.

我打赌它会使用标志re::regexp_pattern(解释为什么显示(?-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
Run Code Online (Sandbox Code Playgroud)