Hi guys,
I need your help, I am working on my program to compare the tags between mystrings1 and mystrings2. When the program have found the matches through on pattern1, it will extract the whole tags from the php source which I only want to extract the strings from mystrings1 tag while ignore the others.
Do you know how i can extract the strings from mystrings1 while ignore the other tags when I get the returned strings?Code:System::Void Form1::timer1_Tick(System::Object^ sender, System::EventArgs^ e) timer1->Enabled = false; timer1::Stop(); try { String ^URL1 = "http://www.mysite.com/myscript.php?user=test&pass=test"; HttpWebRequest ^request1 = safe_cast<HttpWebRequest^>(WebRequest::Create(URL1)); HttpWebResponse ^response1 = safe_cast<HttpWebResponse^>(request1->GetResponse()); StreamReader ^reader1 = gcnew StreamReader(response1->GetResponseStream()); String ^str1 = reader1->ReadToEnd(); String ^pattern1 = "(<p id='mystrings1'>(.*?)</p>(.*?)<span id=\"mystrings2\">Enabled</td>)"; MatchCollection ^matches1 = Regex::Matches(str1, pattern1); for each (Match ^x1 in matches1) { array<String^> ^StrArr1 = x1->Value->ToString()->Split(); MessageBox::Show(x1->ToString()); } } catch (Exception ^ex) { } }
Any advice would be much appriecated.
Thanks,
Mark