EDN Admin
Well-known member
Hi guys,<br/>
<br/>
I need your help, I am using C++/CLI to code my program. I have got a problem with the regex pattern. I couldnt be able to extract the hyperlink from my php page while I find the matches pattern that I selected on the listview items.<br/>
<br/>
Code:<br/>
<pre class="prettyprint
[/code]
I am definitely sure that the html tags has the correct tags name.<br/>
<br/>
However, I have put the breakpoint in this line: <br/>
<pre class="prettyprint Match ^m1 = Regex::Match(str1, pattern1);[/code]
I can see the value for pattern1 so here it is:<br/>
<br/>
<pre class="prettyprint "my strings 1<p id=images>(.*?) "[/code]
<br/>
It have found the matches with the html tag, but it doesnt extract the id. So heres the html tags:<br/>
<br/>
<pre class="prettyprint <p id="images images.php?id=1 Images [/code]
<br/>
Do anyone know how I can extract the id in the images tags from the html source?<br/>
<br/>
Any idea how I can do this?<br/>
<br/>
Thanks in advance.
View the full article
<br/>
I need your help, I am using C++/CLI to code my program. I have got a problem with the regex pattern. I couldnt be able to extract the hyperlink from my php page while I find the matches pattern that I selected on the listview items.<br/>
<br/>
Code:<br/>
<pre class="prettyprint
Code:
<var>private</var>: System::Void Button1_Click(System::Object^ sender, System::EventArgs^ e) {<br/><br/><br/> <var>for</var> each (ListViewItem ^item in <var>this</var>->listView1->CheckedItems)<br/> {<br/> <var>try</var><br/> {<br/> String ^URL1 = <kbd>" http://www.mysite.com/link.php?user=tester http://www.mysite.com/link.php?user=tester" </kbd>;<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 = item->Text + <kbd>"(<p id=images>(.*?) )"</kbd>;<br/> MatchCollection ^matches1 = Regex::Matches(str1, pattern1);<br/> Match ^m1 = Regex::Match(str1, pattern1);<br/><br/><br/> <var>for</var> each (Match ^x1 in matches1)<br/> {<br/> array<String^> ^StrArr1 = x1->Value->ToString()->Split();<br/> String ^test = (URL1 + x1->Value->ToString());<br/> MessageBox::Show(test);<br/> }<br/> }<br/> <var>catch</var> (Exception ^ex)<br/> {<br/><br/> }<br/> }<br/><br/> }
I am definitely sure that the html tags has the correct tags name.<br/>
<br/>
However, I have put the breakpoint in this line: <br/>
<pre class="prettyprint Match ^m1 = Regex::Match(str1, pattern1);[/code]
I can see the value for pattern1 so here it is:<br/>
<br/>
<pre class="prettyprint "my strings 1<p id=images>(.*?) "[/code]
<br/>
It have found the matches with the html tag, but it doesnt extract the id. So heres the html tags:<br/>
<br/>
<pre class="prettyprint <p id="images images.php?id=1 Images [/code]
<br/>
Do anyone know how I can extract the id in the images tags from the html source?<br/>
<br/>
Any idea how I can do this?<br/>
<br/>
Thanks in advance.
View the full article