I have a string that looks like this:
<td width="308">Services Needed: <a href="javascript:void(null);" title="weekly - 1 hour">ST</a></td>
I need to be able to match it, and pull info out. I am trying to use match groups with a regular expression. Belowe is my code:
Match match = Regex.Match(line, @"<a href=""(?<scr>[^""]*)"" title=""(?<title>[^""]*)"">(?<val>[^<]*)");
string val = match.Groups["val"].Value;
What I need to pull out is the “ST” value in the string. I have a match group called val that should be able to pull out this value. However, this regular expression does not match my string. Could someone please assist me with what is wrong with my regular expression?
What do you mean it doesn’t match? I just cut & pasted your code into a new console application, and
match.Groups["val"]contains the value"ST":