EDN Admin
Well-known member
Hi guys,<br/>
<br/>
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.<br/>
<br/>
<br/>
<div style="margin:5px 20px 20px
<div style="margin-bottom:2px Code:
<pre class="x_alt2" dir="ltr" style="margin:0px; padding:3px; border:1px inset; width:780px; height:338px; text-align:left <br/>System::Void Form1::timer1_Tick(System::Object^ sender, System::EventArgs^ e)<br/> timer1->Enabled = false;<br/> timer1::Stop();<br/><br/> try<br/> {<br/> String ^URL1 = "http://www.mysite.com/myscript.php?user=test&pass=test";<br/> HttpWebRequest ^request1 = safe_cast<HttpWebRequest^>(WebRequest::Create(URL1));<br/> HttpWebResponse ^response1 = safe_cast<HttpWebResponse^>(request1->GetResponse());<br/> StreamReader ^reader1 = gcnew StreamReader(response1->GetResponseStream());<br/> String ^str1 = reader1->ReadToEnd();<br/> String ^pattern1 = "(<p id=mystrings1>(.*?) (.*?)<span id="mystrings2 Enabled</td>)";<br/> MatchCollection ^matches1 = Regex::Matches(str1, pattern1);<br/><br/> for each (Match ^x1 in matches1)<br/> {<br/> array<String^> ^StrArr1 = x1->Value->ToString()->Split();<br/> MessageBox::Show(x1->ToString());<br/> }<br/> }<br/> catch (Exception ^ex)<br/> {<br/> }<br/>}[/code]
Do you know how i can extract the strings from mystrings1 while ignore the other tags when I get the returned strings?<br/>
<br/>
Any advice would be much appriecated.<br/>
<br/>
Thanks,<br/>
Mark
View the full article
<br/>
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.<br/>
<br/>
<br/>
<div style="margin:5px 20px 20px
<div style="margin-bottom:2px Code:
<pre class="x_alt2" dir="ltr" style="margin:0px; padding:3px; border:1px inset; width:780px; height:338px; text-align:left <br/>System::Void Form1::timer1_Tick(System::Object^ sender, System::EventArgs^ e)<br/> timer1->Enabled = false;<br/> timer1::Stop();<br/><br/> try<br/> {<br/> String ^URL1 = "http://www.mysite.com/myscript.php?user=test&pass=test";<br/> HttpWebRequest ^request1 = safe_cast<HttpWebRequest^>(WebRequest::Create(URL1));<br/> HttpWebResponse ^response1 = safe_cast<HttpWebResponse^>(request1->GetResponse());<br/> StreamReader ^reader1 = gcnew StreamReader(response1->GetResponseStream());<br/> String ^str1 = reader1->ReadToEnd();<br/> String ^pattern1 = "(<p id=mystrings1>(.*?) (.*?)<span id="mystrings2 Enabled</td>)";<br/> MatchCollection ^matches1 = Regex::Matches(str1, pattern1);<br/><br/> for each (Match ^x1 in matches1)<br/> {<br/> array<String^> ^StrArr1 = x1->Value->ToString()->Split();<br/> MessageBox::Show(x1->ToString());<br/> }<br/> }<br/> catch (Exception ^ex)<br/> {<br/> }<br/>}[/code]
Do you know how i can extract the strings from mystrings1 while ignore the other tags when I get the returned strings?<br/>
<br/>
Any advice would be much appriecated.<br/>
<br/>
Thanks,<br/>
Mark
View the full article