in reply to Re: How to avoid an alphabet and integer next to it in a string?in thread How to avoid an alphabet and integer next to it in a string?
$formula =~ s/H\d*//g;
The Problem with s/H\d*//g is that it will also remove the H from HgS (ok,, not organic chemistry, but you get the point).
One way to avoid that is to use a negative look-ahead:
<p>Or if you prefer the Unicode-y approach:</p>
will also remove the H from HgS
Or simpler, H\d+. \d* will match *zero* or more digits, \d+ matches *one* or more.
update: oh, wait, ignore me. You need to knock out the H in (eg) NaOH, which doesn't have a digit after it.
DejaVu Sans Mono
Droid Sans Mono
Envy Code R
Source Code Pro
The default, whatever it is
Results (66 votes). Check out past polls.