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 8617983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:00:10+00:00 2026-06-12T06:00:10+00:00

I parse an XML file with PHP. My problem is I have a dynamic

  • 0

I parse an XML file with PHP. My problem is I have a dynamic string with multiple lines and each line has no space char on it, and I want to find a word on that string. String’s length is dynamic so it changes every time.

Since strings length is dynamic I can’t use something like $c = substr($string, 0, -1) or I can’t use something like $i=stripos($story," word"); because there is no space in the string.

example string is 4 lines and I want to detect the word ARC.docx on second line before </a>:

<![CDATA[
In <a href='/home/Apps/ARCMeeting'>ARCMeeting</a>, You edited the file <a href='https://dropbox.com/get/Apps/ARCMeeting/ARC.docx?w=d3' title='&#47;Apps&#47;ARCMeeting&#47;ARC.docx'>ARC.docx</a>.
<br/>
]]>

My goal is add that ARC.docx on second line before </a> to a message body

$message='X File has been edited!';

so I can print

$message='ARC.docx File has been edited!';

How can I detect word that in between .......>exampleword</a>. in above string?

Thanks in advance

  • 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-12T06:00:13+00:00Added an answer on June 12, 2026 at 6:00 am

    You can try preg_match function.

    In your case it will look something like:

    $subject = "In <a href='/home/Apps/ARCMeeting'>ARCMeeting</a>, You edited the file <a href='https://dropbox.com/get/Apps/ARCMeeting/ARC.docx?w=d3' title='&#47;Apps&#47;ARCMeeting&#47;ARC.docx'>ARC.docx</a>"
    
    preg_match("/title=(.*)>(.*)<\/a>/U", $subject, $matches);
    
    echo $matches[2]; // $matches[2] will contain `ARC.docx`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML file and parse it into my PHP document. I want
I have an XML file which I need to parse using PHP and send
I have this problem where all URLs like context/path/file/anything/that/follows becomes context/path/file.php/anything/that/follows or context/path/file.xml/anything/that/follows .
I'm trying to parse XML file (RSS Feed), but I have a problem that
I'm trying to parse an xml file with PHP. I'm using this code and
I am beginner in PHP. I am trying to parse this xml file. <relationship>
I am using php's simple xml and xpath to parse an rdf xml file
I use nokogiri(which in turn uses xpath) to parse xml file. xml has some
I have written a small function, which uses ElementTree to parse xml file,but it
I have a pretty large file that I need to parse in php, so

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.