Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to compare the value before split?
    primarykey
    data
    text
    <p>I have got a problem with my program as they are extract the whole html tags when I am trying to compare between two tags " and the Enabled">". What I want my program to do is to find the tags in the php source called mystrings1 to see if they does exist then find the tags called mystrings2 with value "enabled" on the same line as the mystrings1 for each matches, then extract the mystrings1 value.</p> <p>On my program, it reads the whole tags like this:</p> <pre><code>[PHP] &lt;p id='mystrings1'&gt;user data 1&lt;/p&gt;&lt;p id="images"&gt; &lt;a href="images.php?id=1"&gt;Images&lt;/a&gt; &lt;/td&gt; | &lt;a href="http://mylink.com"&gt;Link&lt;/a&gt; &lt;/td&gt; | &lt;a href="delete.php?id=1"&gt;Delete&lt;/a&gt; &lt;/td&gt; | &lt;span id="mystrings2"&gt;Enabled&lt;/td&gt; [/PHP] </code></pre> <p>Here's the form code:</p> <pre><code> #include "StdAfx.h" #include "Form1.h" using namespace MyProject; System::Void Form1::timer1_Tick(System::Object^ sender, System::EventArgs^ e) { timer1-&gt;Enabled = false; timer1-&gt;Stop(); try { String ^URL1 = "http://mysite.com/myscript.php?user=test&amp;pass=test"; HttpWebRequest ^request1 = safe_cast&lt;HttpWebRequest^&gt;(WebRequest::Create(URL1)); HttpWebResponse ^response1 = safe_cast&lt;HttpWebResponse^&gt;(request1-&gt;GetResponse()); StreamReader ^reader1 = gcnew StreamReader(response1-&gt;GetResponseStream()); String ^str1 = reader1-&gt;ReadToEnd(); String ^pattern1 = "(&lt;p id='mystrings1'&gt;(.*?)&lt;/p&gt;(.*?)&lt;span id=\"mystrings2\"&gt;Enabled&lt;/td&gt;)"; MatchCollection ^matches1 = Regex::Matches(str1, pattern1); Match ^m1 = Regex::Match(str1, pattern1); for each (Match ^x1 in matches1) { array&lt;String^&gt; ^StrArr1 = x1-&gt;Value-&gt;ToString()-&gt;Split(); MessageBox::Show(x1-&gt;Value-&gt;ToString()); } } catch (Exception ^ex) { } } </code></pre> <p>Please can someone tell me how i can compare the tags between mystrings1 and mystrings2 with value "enabled" to see if it have found the matches, then display the messagebox with the mystrings1 value?</p> <p>Any advice would be much appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload