How to use regexp to identify the number of hydrogens in a chemical formula? : <p>Which expression should I use to identify the number of hydrogen atoms in a chemical formula?</p>

<p>For example:</p>

<p>C40H51N11O19 - 51 hydrogens</p>

<p>C2HO - 1 hydrogen</p>

<p>CO2 - no hydrogens (empty)</p>

<p>Any suggestions?</p>

<p>Thanks!</p>

<p>Cheers!</p>
