Given below is C# code. I have tried the same Regular expression which is there in the code, but for some reason I am not getting the diesired output. The html given in the code is just an example. The code can be compiled using C# compiler.
Here is the code.
var x = @"
<html>
<table>
<tr>
<td class=""l w60"">Adjustments:<input id=""textbox1"" type=""textbox"" name=""textbox1"" data-label-text=""Misc. Comment12""/> </td>
<td class=""l w60"">Adjustments:<input id=""textbox1"" type=""textbox"" name=""textbox1"" data-label-text=""Misc. Comment13""/> </td>
<td class=""l w60"">Adjustments:<input id=""textbox1"" type=""textbox"" name=""textbox1"" No match=""Misc. Comment13""/> </td>
</tr>
</table>
</html>";
Regex regex = new Regex(@"[\n\r].*data-label-text=""\s*([^\n\r]*)");
MatchCollection matchList = regex.Matches(x);
var list = matchList.Cast<Match>().Select(match => match.Value).ToList();
When I see the contents of the list I find these two values.
1. <td class="l w60">Adjustments:<input id="textbox1" type="textbox" name="textbox1" data-label-text="Misc. Comment12"/> </td>
2. <td class="l w60">Adjustments:<input id="textbox1" type="textbox" name="textbox1" data-label-text="Misc. Comment13"/> </td>
But this is not the desired output. The desired output is given below.
1.Misc. Comment12
2.Misc. Comment13
Something has to be modified in Regex to get the desired output which I am not good at. Please tweak the Regex, so that desired output can be achieved.