0

I am new to C#. I have been working on a C# console project. I sent a request to a server and get a very lengthy response string (html format). I want to extract and get some information from this string. If I use javascript I know how to fetch. This is console project. How do I extract it? Thanks.

3
Contributors
5
Replies
6
Views
9 Years
Discussion Span
Last Post by nidhsek
0

Use regular expression to extract some string from the long string (HTML message), give me an example and may I help you by give you regular expression pattern to extract data by.

0

There is a drop-down (html select list) in the html source. I want to fetch all the values within that select box (option items). I don't want to use forms. This is console app. Please adivce.

<select name="listnames" id="listnames">
<option value="190">my data 1</option>
<option value="1930">my data 2</option>
...............................
</select>

0

As Ramy suggested, you can use regexp to parse the response string. However, it might get tricky if there are multiple dropdowns.

Jeff Heaton has written a parser in C# which would be just the one you are looking for ... search for "Parsing HTML in Microsoft C# By Jeff Heaton" and you would get his article with the code.

0

I have only one select drop down in my response text. Can you tell me with some code, how to get option value using regular expression. Thanks.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.