我编写了一个正则表达式来检查俱乐部会员编号,其有效值为 1) pl-XXXX
2)gl-XXXX
其中XXXX
1000-9999。
我的正则表达式工作正常,但我无法理解为什么会显示以下警告 -
"Quantifier unexpected on zero-length expression in regex; marked by <-- HERE in
m/^{2}[pl,gl]+[-]{1}+[1-9]{1}+[0-9]$ <-- HERE / at test.pl line 62."
我的代码:
if ($count == 3){ ## check club identifier ##
if ($_ =~ /^{2}[pl,gl]+[-]{1}+[1-9]{1}+[0-9]$/){
say "Line4 Good: ", $currLine;
} else {
say "Error in Line 4: Not a club member ";
}