【发布时间】:2022-04-06 22:34:24
【问题描述】:
这段代码:
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
----------------------------------------------------------------------
怎么了?
【问题讨论】:
-
我没有真正的答案,但你试过Regexp::Debugger吗?
-
似乎是unicode_strings feature。
use feature "unicode_strings";的行为相同