I have the following array:
a = ["CH3", "CH2"]
and I would like to split it between two uppercase letters using the reg expression to display: a= ["C", "H3", "C", "H2"] How do you do this?
So far I have tried:
a.each { |array| x = array.scan(/[AZ]*/) puts a } returns: CH CH
Thanks in advance!
split ruby regex
JZ.
source share