-4

I have an Html page in string.

  <html> 
    .....
    <script>
        {
           http:\\\/\\\/cs513404v4.vk.me\\\/u3692175\\\/videos\\\/49a2e8d28c.720.mp4 
        }
        .....
    </script>
  </html>

There is a link in this html page. How can I search for "720.mp4" and take all this link. Thanks for the HELP.

user2660964
  • 141
  • 1
  • 9

1 Answers1

2

Simple regexp will help you.

You are looking for something start with with http and ending with 720.mp4

The example code:

string strRegex = @"http.*720.mp4";
RegexOptions myRegexOptions = RegexOptions.None;
Regex myRegex = new Regex(strRegex, myRegexOptions);
string strTargetString = @"<html> " + "\n" + @"    ....." + "\n" + @"    <script>" + "\n" + @"        {" + "\n" + @"           http:\\\/\\\/cs513404v4.vk.me\\\/u3692175\\\/videos\\\/49a2e8d28c.720.mp4 " + "\n" + @"        }" + "\n" + @"        ....." + "\n" + @"    </script>" + "\n" + @"  </html>";

foreach (Match myMatch in myRegex.Matches(strTargetString))
{
  if (myMatch.Success)
  {
    // Add your code here
  }
}
Piotr Stapp
  • 19,392
  • 11
  • 68
  • 116