Jump to content

[SOLVED] RegEx problem again...


SoundreameR

Recommended Posts

Hi again guyz...  ;D I have a very dumb problem... If I have a html output, how can I get only the content of a specific tag, removing everything else, including TEXT. strip_tags helped in removing some tags, but the text is still there... Ex.: If there is a bunch of code, I want to get only the content of <h2></h2> tags. Like this:

Input code:

bla bla <br>
muhaha <br>
<h2>[NEEDED CONTENT]<h2>
foo foo foo <br>
the bar <br>
emo mu <br>
<h2>[NEEDED CONTENT 2]<h2>
etc...

Output code:

<h2>[NEEDED CONTENT]<h2>
<h2>[NEEDED CONTENT 2]<h2>

;D

Link to comment
https://forums.phpfreaks.com/topic/58065-solved-regex-problem-again/
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.