Groups | Blog | Home
all groups > dotnet general > november 2004 >

dotnet general : RegEx



dimension
11/16/2004 11:39:01 PM
Hi,

If i have a string like this:
"<td class="yfnc_tablehead1" width="75%">Float:</td><td
class="yfnc_tabledata1">2.20M</td>
<td class="yfnc_tablehead1" width="75%">Outstanding Shares:</td><td
class="yfnc_tabledata1">222.20M</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 "Outstanding Shares", but now quite sure how to do
Leon Mayne [MVP]
11/17/2004 9:43:53 AM
[quoted text, click to view]

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.

dimension
11/17/2004 5:12:02 PM
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...

[quoted text, click to view]
AddThis Social Bookmark Button