Regex

  • Thread starter Thread starter Chuck Norris
  • Start date Start date
C

Chuck Norris

Hi,
I don't know very much about regular expression and
I'm wondering how to extract the numeric value 0.693 from the
following text.

"&nbsp;1&nbsp;EUR&nbsp;=<b>&nbsp;0.693&nbsp;GBP&nbsp;</b>"

Thanks.
 
Hi,
I don't know very much about regular expression and
I'm wondering how to extract the numeric value 0.693 from the
following text.

"&nbsp;1&nbsp;EUR&nbsp;=<b>&nbsp;0.693&nbsp;GBP&nbsp;</b>"

Thanks.

Assuming the values you're looking for are always between html bold
elements and will always have at least 1 digit both left and right of
the decimal point, the following should do it:

<b> (\d+\.\d+).*</b>

0.693 would be in match.groups[1]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top