http://www.perlmonks.org?node_id=756680


in reply to Re^2: Recursive capture of a variable number of elements using regexp
in thread Recursive capture of a variable number of elements using regexp

As long as the formulas are sum formulas, there should be no problem, as each element should be summed up and shouldn't appear again in the same formula. So it should be fine with C2H6O.

If the formula tries to represent some kind of molecular structure, you may be right: CH3CH2OH

(Both formulas represent ethanol).