s = 'a5bc2cdf3'index = 5result = ""s.gsub!(/([a-zA-Z]+)(\d+)/){ result << $1*$2.to_i break if $~.end(0) >= index}puts result[index]
Standard input is empty
b
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!