-5
<a href="http://192.168.1.218/idea/abc/coding.aspx">This page contains code.</a>

<a href="..................../idea/xyz/title.aspx">This is the Title Page.</a>

<a href="..................../idea/jkl/head.aspx">Nothing to do with this.</a>

In results i want abc, xyz, jkl only.

What will be the regular expressions or code for the same...?

Alex K.
  • 171,639
  • 30
  • 264
  • 288
  • See [What is the best way to parse html in C#?](http://stackoverflow.com/questions/56107/what-is-the-best-way-to-parse-html-in-c) – Alex K. Apr 15 '15 at 12:41
  • can you post any code over here? – Shubham Bhave Apr 15 '15 at 12:42
  • WebClient web = new WebClient(); string html = web.DownloadString("http://192.168.1.218.com/"); MatchCollection mc = Regex.Matches(html, @"href=[']([^']+?)[']", RegexOptions.Multiline); – Lavkesh Miglani Apr 15 '15 at 12:46

1 Answers1

0

Something like this:

var bits = Regex
    .Matches(html, @"/idea/(.*?)/.*?.aspx\"">")
    .Cast<Match>()
    .Select(m => m.Groups[1]);

But don't do this unless you know what you're doing - Use the HTML Agility Pack, instead

Dave Bish
  • 19,263
  • 7
  • 46
  • 63