RegEx

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dimension

    RegEx

    Hi,

    If i have a string like this:
    "<td class="yfnc_tab lehead1" width="75%">Flo at:</td><td
    class="yfnc_tab ledata1">2.20M</td>
    <td class="yfnc_tab lehead1" width="75%">Out standing Shares:</td><td
    class="yfnc_tab ledata1">222.20 M</td>"

    And i wanted to parse the value for Float and OutStanding shares, what is
    the best way to do this? I was thinking of using regular expression and
    searching for "Float" and "Outstandin g Shares", but now quite sure how to do
    it. can anyone assist?
  • Leon Mayne [MVP]

    #2
    Re: RegEx

    dimension wrote:[color=blue]
    > Hi,
    >
    > If i have a string like this:
    > "<td class="yfnc_tab lehead1" width="75%">Flo at:</td><td
    > class="yfnc_tab ledata1">2.20M</td>
    > <td class="yfnc_tab lehead1" width="75%">Out standing Shares:</td><td
    > class="yfnc_tab ledata1">222.20 M</td>"
    >
    > And i wanted to parse the value for Float and OutStanding shares,
    > what is the best way to do this? I was thinking of using regular
    > expression and searching for "Float" and "Outstandin g Shares", but
    > now quite sure how to do it. can anyone assist?[/color]

    Considering that snippet would classify as XML as well, you could just read
    it in as XML and then parse it to get the values. Just iterate through the
    siblings on a key-value basis.


    Comment

    • dimension

      #3
      Re: RegEx

      Thanks for the response. Although i believe the layout of the table that
      displays the info i request will remain fixed, there is no guarantee that the
      rest of the page will or that it will contain well-formed HTML. I don't
      wan't to have to worry about "tidying" up the HTML in order to load it into
      some DOM. I would prefer using one of the regular expression classes and
      matching groups. but i need some assistance on what the regular expression
      would be...

      "Leon Mayne [MVP]" wrote:
      [color=blue]
      > dimension wrote:[color=green]
      > > Hi,
      > >
      > > If i have a string like this:
      > > "<td class="yfnc_tab lehead1" width="75%">Flo at:</td><td
      > > class="yfnc_tab ledata1">2.20M</td>
      > > <td class="yfnc_tab lehead1" width="75%">Out standing Shares:</td><td
      > > class="yfnc_tab ledata1">222.20 M</td>"
      > >
      > > And i wanted to parse the value for Float and OutStanding shares,
      > > what is the best way to do this? I was thinking of using regular
      > > expression and searching for "Float" and "Outstandin g Shares", but
      > > now quite sure how to do it. can anyone assist?[/color]
      >
      > Considering that snippet would classify as XML as well, you could just read
      > it in as XML and then parse it to get the values. Just iterate through the
      > siblings on a key-value basis.
      >
      >
      >[/color]

      Comment

      Working...