Jump to content

Recommended Posts

I've a question about how use the regular expression to find a tag.

 

For sample. I've a code:

 

<div class=Section1>

<p class=Title><o:p> </o:p></p>

<p class=Title align=center style='text-align:center'>title title title title </p>

<p class=Title><o:p> </o:p></p>

<p class=Author><st1:PersonName ProductID=""
w:st="on">Name</st1:PersonName></p>

<p class=Author>Some <st1:PersonName
ProductID="" w:st="on">thing</st1:PersonName>
about the author</p>

<p class=Author>More about the author</p>

<p class=Author><o:p> </o:p></p>

<p class=chapter>1. chapter 1</p>

<p class=Text>text...</p>
<p class=Text>text...</p>

 

Yes, it's with garbage from msword.

 

I need take in this code the follow:

 

Name
Some thing about the author
More about the author

 

I tried but I can't get the point.

 

If I use like this:

 

preg_match_all('#<p class=Author>([^<]*)</p>#s',$text,$val);

 

Don't work, 'cause there are more </p> in the text. How I do for it stop in the first </p>?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/197654-how-seek-and-split-content-in-tags/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.