Dark Knight
Dark Knight

Reputation: 19

PHP preg_match with html tags

I'm trying to exctract some string inside a pattern.

the string is

<br /><br /><br />Text i want here
<br /></div>

i want the: "Text i want here"

My attemp was

preg_match('!<br /><br /><br />(.*?)<br /></div>!xi', $homepage, $matches);

But failed.

**I use the x because may between
they have some white space or \n.

<br />
<br />
<br />Text u want here
<br /></div>

Upvotes: 1

Views: 1666

Answers (1)

Muthu Kumaran
Muthu Kumaran

Reputation: 17910

use strip_tags("<br /><br /><br />Text i want here<br /></div>").

strip_tags will strip all HTML and PHP tags from a string.

Upvotes: 1

Related Questions