我正在尝试提出一个匹配任何不是 32 位整数的正则表达式。我的最终目标是匹配不符合以下格式的行
Integer\tInteger\tInteger\tInteger\tInteger\tInteger\tInteger
(7 个 32 位整数和每个整数之间的 1 个制表符)
到目前为止,我已经想出了这个
#!/usr/bin/perl -w
use strict;
while ( my $line = <> ) {
if ( $line =~ /^(429496729[0-6]|42949672[0-8]\d|4294967[01]\d{2}|429496[0-6]\d{3}|42949[0-5]\d{4}|4294[0-8]\d{5}|429[0-3]\d{6}|42[0-8]\d{7}|4[01]\d{8}|[1-3]\d{9}|[1-9]\d{8}|[1-9]\d{7}|[1-9]\d{6}|[1-9]\d{5}|[1-9]\d{4}|[1-9]\d{3}|[1-9]\d{2}|[1-9]\d|\d)$/ ) {
print "Match at line $.\n";
print "$line"
}
}
但我什至无法迈出让正则表达式匹配 32 位数字的第一步(一旦我解决了这个问题,我就可以解决让标签成为他们需要的方式)
我是否以正确的方式解决了这个问题?有什么想法吗?