replacing breaks

philsivyer used Ask the Experts™
I am using a reporting tool to download some html fields from an oracle database.  I am stripping out breaks using the following in a formula field in my report ...
REPLACE({COMMENT_HTML2},"<br />","<br>");
Unfortunately, any single line breaks are removed.
What I would really like is to strip out any double/multiple breaks but leave a break if there is just the one.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
First of all, <br> is invalid.  It works, but it's invalid.  The only reason it works is because browsers change <br> to <br /> as a matter of error correction.  You should always use <br />.

Also, what language are you using?  Can you provide a sample of the text you want to replace.  We will probably need to use a regular expression to do this properly.  The quick and dirty would be to do something like this:

REPLACE({COMMENT_HTML2},"<br /><br /><br /><br /><br />","<br />");
REPLACE({COMMENT_HTML2},"<br /><br /><br /><br />","<br />");
REPLACE({COMMENT_HTML2},"<br /><br /><br />","<br />");
REPLACE({COMMENT_HTML2},"<br /><br />","<br />");



Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial