2015年6月13日星期六

perl 5.22 : Prevent the grouping metacharacters () from capturing

https://metacpan.org/pod/distribution/perl/pod/perlre.pod

/n 不抓取 () 匹配的内容

"hello" =~ /(hi|hello)/;   # $1 is "hello"
"hello" =~ /(hi|hello)/n;  # $1 is undef

没有评论:

发表评论