Hi,
I have the following HTML code:
After "cleaning" the code, I want to end up with the following:
AKA, I want to remove all the HTML tags except the link
I searched on Google, this forum and others.
I tried regular expressions combined with preg_
I tried I tried Nothing seemed to work.
In the end I ended up with the following:
I do believe that using a reg express should be the way to go, but I'm struggling of coming up with one that covers everything I need.
Any help would be greatly appreciated.
With kind regards,
George
I have the following HTML code:
Code:
A line of text, which is of any length. Ohw yes it is!<br /><br />
<h2>And a header</h2>
<img src="image.jpg>With an image and a <a href="/">link</a>. With some more text.
After "cleaning" the code, I want to end up with the following:
Code:
A line of text, which is of any length. Ohw yes it is! With an image and a <a href="/">link</a>. With some more text.
AKA, I want to remove all the HTML tags except the link
I searched on Google, this forum and others.
I tried regular expressions combined with preg_
I tried I tried Nothing seemed to work.
In the end I ended up with the following:
Code:
$string = $this->item->fulltext;
$search = array('/\<(.+)>(.*)>/si'); //Strip out HTML tags
$string = preg_replace($search, '', $string);
I do believe that using a reg express should be the way to go, but I'm struggling of coming up with one that covers everything I need.
Any help would be greatly appreciated.
With kind regards,
George