如何在Perl中组合两种模式
我想将这两个正则表达式合二为一
next if $line =~ /^#/ or $line =~ /^d+-d+/;
回答
“或”很简单:使用交替|:
next if $line =~ /^#|^d+-d+/
你甚至可以考虑^:
/^(?:#|d+-d+)/
我想将这两个正则表达式合二为一
next if $line =~ /^#/ or $line =~ /^d+-d+/;
“或”很简单:使用交替|:
next if $line =~ /^#|^d+-d+/
你甚至可以考虑^:
/^(?:#|d+-d+)/