我在我的一个脚本上运行了Perl :: Critic,并收到了以下消息:
Regular expression without "/x" flag at line 21, column 26. See page 236 of PBP.
Run Code Online (Sandbox Code Playgroud)
我在这里查看了策略信息,并且我理解在扩展模式下编写正则表达式将有助于任何正在查看代码的人.
但是,我被困在如何转换我的代码以使用/ x标志.
CPAN示例:
# Match a single-quoted string efficiently...
m{'[^\\']*(?:\\.[^\\']*)*'}; #Huh?
# Same thing with extended format...
m{
' # an opening single quote
[^\\'] # any non-special chars (i.e. not backslash or single quote)
(?: # then all of...
\\ . # any explicitly backslashed char
[^\\']* # followed by an non-special chars
)* # ...repeated zero or …Run Code Online (Sandbox Code Playgroud)