Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8071455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:41:51+00:00 2026-06-05T13:41:51+00:00

I have got a problem with my program as they are extract the whole

  • 0

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.

On my program, it reads the whole tags like this:

[PHP]
<p id='mystrings1'>user data 1</p><p id="images">
<a href="images.php?id=1">Images</a>      </td> | <a href="http://mylink.com">Link</a> </td> | <a href="delete.php?id=1">Delete</a>   </td> | <span id="mystrings2">Enabled</td>
[/PHP]

Here’s the form code:

 #include "StdAfx.h"
 #include "Form1.h"

 using namespace MyProject;

 System::Void Form1::timer1_Tick(System::Object^  sender, System::EventArgs^  e)
 {
     timer1->Enabled = false;
     timer1->Stop();

     try
     {
         String ^URL1 = "http://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);
         Match ^m1 = Regex::Match(str1, pattern1);

         for each (Match ^x1 in matches1)
         {
             array<String^> ^StrArr1 = x1->Value->ToString()->Split();
             MessageBox::Show(x1->Value->ToString());
         }
     }
     catch (Exception ^ex)
     {
     }
 }

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?

Any advice would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:41:53+00:00Added an answer on June 5, 2026 at 1:41 pm

    this code might help you

    // set str1 to a constant string for testing
    String^ str1 = "<p id='mystrings1'>user data 1</p><p id=\"images\"> <a href=\"images.php?id=1\">Images</a></td> | <a href=\"http://myhotlink.com\">Link</a> </td> | <a href=\"delete.php?id=1\">Delete</a> </td> | <span id=\"mystrings2\">Enabled</td>";
    // the pattern is the key part to figure out
    String ^pattern1 = "<p\\sid='mystrings1'>(?<mystrings1value>[^<>]+)</p>.*<span\\sid=\\\"mystrings2\\\">Enabled";
    Regex^ r = gcnew Regex (pattern1, RegexOptions::IgnoreCase);
    
    Match ^m1 = r->Match(str1);
    if (m1->Success)
    {
        MessageBox::Show (m1->Groups["mystrings1value"]->Value);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Got a problem with a query I'm trying to write. I have a table
I got a weird problem. I have a program that (does many things but
I have got a problem with calling a global function, which takes a pointer
I have got a strange problem about in_array recently which I cannot understand. e.g.
I have got a performance problem about TextField.htmlText +=msg .And I know that TextField.appendText(msg)
I have got very big problem because I would like to get more information
I have got a the following problem: I have got multi-step form where in
Can't understand what is a problem here: I have got main.cpp file where I
ok i got this problem. i have this routes: (code bit change) File:/home/dotcloud/current/config/routes.js exports.routes
I've got a problem I can't find any solution for. I have a textfile

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.