|Just another Perl shrine
substrings that consist of repeating charactersby Anonymous Monk
|on Sep 27, 2020 at 17:30 UTC
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi. I am studying regular expressions and wanted to write a script that searches a DNA string for the longest substrings that consist of repeating letters. For example: CCCCC or GGG or AAAA etc. I managed to do that, but i am not very happy with the end resuslt. I was hoping to get most of the work done with a regex, in that regard i have failed. Furthermore there are statements in the while loop that look doubtful, and the idea of using an array to store the substring along with its length might not be good. Any advice is welcome. Thank you.