Regex search in list for numbers have 3 or more digit occures -
i have list of 6 digits number [0-9].
examples:
001601 001602 001610 145784 487457 894571 111299 121118
results:
001601 001602 001610 0 occurs 3 times 111299 1 occurs 3 times 121118 1 occurs 4 times
here perl way it:
my $re = qr~(.).*\1.*\1~; while(<data>) { chomp; $_ =~ $re ? "ok : $_" : "ko : $_"; } __data__ 001601 001602 001610 145784 487457 894571 111299 121118
output:
ok : 001601 ok : 001602 ok : 001610 ko : 145784 ko : 487457 ko : 894571 ok : 111299 ok : 121118
Comments
Post a Comment