Are you just trying to remove the empty <p></p> tag pairs, or all of the <p></p> tags and their content?
Hi thanks for your answer, I am indeed trying just to remove the empthy <p></p> tags, but because there is spave between those tags and around them I have great problems removing it with replace, I guess I need a regular expression?
Yes, that was going to be my next suggestion, although I couldn't tell you what that RegEx would look like. Good luck!
Well that means I am moving in the right direction then, thanks, I will give it a Google once more...
Well, I am really suprised that this is so hard to do, al I can find is info about using a html filter. I really only need to replace "<p> </p>", why isn't it easily possible with replace code?
Does anyone know of a regex that works for replacing "<p> </p>" ?
1 person found this helpful
string = "<p>Don't Delete Me 1!</p>
<P>Don't Delete Me 2!</p>
<p>I hope it doesn't delete me 3!</p>
writeOutput( '<textarea>#reReplaceNoCase( string, '<p>[[:space:]]*</p>', "", "ALL")#</textarea>' );
Hi thanks for your reply, your example works perfect, only when I try to use it in my code it doesn't work, here's what I do:
<cfset text = REReplaceNoCase(text, '<p>[[:space:]]*</p>', "", "ALL")>
Maar stilte hebben we nodig om onszelf te vinden. Weten wie we in werkelijkheid zijn, wat onze missie of doelstelling in dit leven is.</p>
Stilte geeft ons kracht</p>
Is the cfscript writeoutput treated differently?
Finally got the solution!
Using a filter function by: http://www.bennadel.com/index.cfm?event=blog.viewcode&id=1155&index=1
I saw that the mysterious empthy space <p> </p> was replaced by <p> </p>.
Next was a simple:
<cfset text = ReplaceNoCase(text, "<p>&##160;</p>", "", "ALL")>
and all is fine...
So, the bottom line is "know what you are looking for".