Jump to content

How seek and split content, in tags


Druide

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.