tags:

views:

17

answers:

1
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>title</title>
</head>
<body>
    <a href="aaa.asp?id=1"> I want to get this text </a>
    <script>
    var test=function()
        {}
    </script>
</body>
</html>

and the result is: line:7, position :4 content:

var test=function()
{}
+2  A: 

Have you tried the HTML Agility Pack?

This typically works quite well and gives you a nice intuitive interface into parsing HTML content.

You should be able to use it something like this:

 HtmlDocument doc = new HtmlDocument();
 doc.Load("yourfile.html");

 foreach(HtmlNode link in doc.DocumentElement.SelectNodes("//script)
 {
    // do something with your script nodes
 }
marc_s