 <p>It's always better to use mathematical function to perform mathematical operations.<br> Not only does it make the code more readable, it's also likely to have better performance.<br> Therefor, as <a href="http://stackoverflow.com/users/3832970/stribizhev">stribizhev</a> wrote in the comments - <code>Use #1</code> :).</p> <p>Also, your regular expression does not take into consideration that different cultures might have different decimal separators.<br> Not everyone is writing one and a quarter as <code>1.25</code>, some cultures use <code>,</code> as the decimal separator and thus it's written as <code>1,25</code>.<br> Should you encounter a decimal like that, your regular expression will not work as you expect.</p>