String html = getSource();
List<Group> newGroups = new List<Group>();
r = new Regex("class=lnk href\\s*=\\s*(?:\"(?<1>[^\"]*)\"|(?<1>\\S+))", RegexOptions.IgnoreCase | RegexOptions.Compiled);
for (m = r.Match(html); m.Success; m = m.NextMatch())
{
MessageBox.Show("Link" + m.Groups[1].Value);
//new modified code
newGroups.Add(m.Groups[index]); //not 1 as you say
}
Read my comments in the code I may got you wrong.
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Sure it won't work as index not defined but what I need to say is you everytime add the same Group instance which in the index 1 of the array of Group.
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Can you please give me the link? to know what's this about.
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
String html = richTextBox1.Text;
List<string> matches = new List<string>();
Regex r = new Regex("href\\s*=\\s*(?:\"(?<1>[^\"]*)\"|(?<1>\\S+))", RegexOptions.IgnoreCase | RegexOptions.Compiled);
Match m;// = r.Match(
for (m = r.Match(html); m.Success; m = m.NextMatch())
{
matches.Add(m.Value);
MessageBox.Show(m.Value);
//new modified code
//newGroups.Add(m.Groups[index]); //not 1 as you say
}
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
That's what you needed?? or it popup unneeded string?
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
You're welcome, just made sure it meets your need.
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276