Re: Regex

Tech-Archive recommends: Speed Up your PC by fixing your registry



On Sep 17, 11:23 am, Chuck Norris <ciccone1...@xxxxxxxxx> wrote:
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]

.



Relevant Pages

  • Re: ada is getting spanked :(
    ... function Extract return Integer is ... function Safe (Digit: Integer) return Boolean is ...
    (comp.lang.ada)
  • Re: Extracting Strings
    ... regular expression and php function that does it. ... I want to extract the data in the following string: ... The characters in the square brackets are the characters to match ...
    (alt.php)
  • Re: Extracting Strings
    ... regular expression and php function that does it. ... I want to extract the data in the following string: ... The characters in the square brackets are the characters to match ...
    (alt.php)
  • Re: inefficient regex - please help!
    ... Are you sure you have the right regular expression here? ... you're trying to *extract* the newlines ... Connection" occurance - but you state you want to "count" the occurances. ...
    (comp.lang.perl.misc)
  • Re: Extracting Strings
    ... regular expression and php function that does it. ... I want to extract the data in the following string: ...
    (alt.php)