If I have a list of numbers like
112536
523534
241255
233345
212121
in a text file.
And I want to find any number where a digit is repeated three times in a row or a 2-digit set is repeated three times in a row, how would I do that?
The dumb way to do it is something like
while (line = f.gets)
g.puts line if line =~ /111/
g.puts line if line =~ /222/
g.puts line if line =~ /333/
etc...
But that's obviously not efficient. Is there a simpler way to do this?