Regular Expression: Searching and Replacing 2 or more digits in Ruby



I found this regular expression to match 2 or more digits in Ruby and then replace it:

a = %w(4 1 1 0 4 4 0 0 4 4 4)
a.join.gsub(/4{2,}/,'ab')

Output would be

4 1 1 0 a b 0 0 a b