[eluser]bugboy[/eluser]
Hi all
I'm trying to remove blocks of html from stings of text.
Once they are removed i place a marker where they were and then run some code before adding them back in.
This regex does it for most html tags apart from image tags <img />
Code:
"|<[^>]+>(.*)</[^>]+>|U"
I also want to try and remove whole blocks of html from a string.
so for example say i have a string that looks like this. This contains links, images and youtube.
Code:
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. This is <a href="http://example.com/" title="Optional Title Here">title for this link reference-style link. This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. This is <a href="http://example.com/" title="Title">an example</a> inline link. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
<img src="/media/display/Photo_10.jpg" alt="Photo_10.jpg" />
<object height="350" width="425">
<param name="movie" value="http://www.youtube.com/v/bvWQNa1czG4" />
<param name="wmode" value="transparent" />
<embed src="http://www.youtube.com/v/bvWQNa1czG4" type="application/x-shockwave-flash" height="350" wmode="transparent" width="425" />
</embed></param></param></object>
i would like it to be outputtd like this.
Code:
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. This is {*0} title for this link reference-style link. This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. This is {*1} inline link. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
{*2}
{*3}
I can't seem to figure it out i get so far with it and then it breaks.
Any help would be greatly appreciated.
Thanks for your time