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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -