I have ran into a problem trying to use Regex to copy a string out of an Html string and its not giving me what I need.
I am trying to get the table out of a Div and I have tried this with RegEx
string strLook = respData2;
string s = Regex.Match(strLook, "<div id='results'(.+)</div>", RegexOptions.Singleline).Groups[1].Value;
this is just giving me the whole Html string.
I have also tried using SubString
int starPos = strLook.LastIndexOf("<div id='results'>") + "<div id='results'>".Length + 1;
int length = strLook.IndexOf("</div>") - starPos;
string sub = strLook.Substring(starPos, length);
When I step through the SubString, it says that the last index is 18, well I know that the Div is not 18 characters away from the beginning (unless I am wrong what the 18 is for), this isn't even getting the Div either.
So how do I get the contents of the Div, which is a html table, so I can write it to a file.
Thanks