I need a way to separate a chemical formula into its components. The result should look like this:
Ag3PO4 -> [
this pattern should work depending on you RegEx engine ([A-Z][a-z]*\d*)|(\((?:[^()]+|(?R))*\)\d*) with gm option Demo
([A-Z][a-z]*\d*)|(\((?:[^()]+|(?R))*\)\d*)
gm