my ($INV_NB, $USAGE)=split /\|/,"9998|999999999999999";
if ($USAGE=~/^\d{15}\b/)
{
print "\nUSAGE is Valid\n";
print "length of $USAGE is ",length($USAGE);
}
這按預期工作,但我該如何否定這個正則表達式?說,如果使用不/^\d{15}\b/
否定一個perl正則表達式
if ($USAGE!=~/^\d{15}\b/)
{
print "\nUSAGE is Invalid\n";
print "length of $USAGE is ",length($USAGE);
}
我嘗試這樣做,但它不是工作..
使用代碼中的選項卡是禁忌的。 – 2011-06-28 11:23:49
還有'除非(EXPR)BLOCK',它可能會使意義更明顯。 – Mike