I need to take out the longest substring of uppercased characters. So out of the string:
"aaBBBBcBBdDDD"
I need to get "BBBB"
.
Is there a convenient Ruby method for that or a regexp of some kind? I tried:
string.scan(/[[:upper:]]/)
and that's almost it, only it gives ALL capital characters, not the longest sequence.