CFML_Developer
CFML_Developer

Reputation: 1605

Remove extra spaces, line feed and carriage return without using regex

We currently generate an html and then clean up the whitepace (generated even after the CF admin setting)

<cfset Str = REReplace(Str, "[#Chr(9)##Chr(10)##Chr(13)#]", "", "all")>

It works, but in some of the html is huge and regex shows memory issues. How can I do it without using regex, with simple Replace function may be? Idea is, we can identify beforehand that this html is going to be bigger and parse that through simple Replace instead of regex?

Upvotes: 0

Views: 350

Answers (1)

Daemach
Daemach

Reputation: 467

I've found Lucee's whitespace management to work quite well. Might be worth a look.

enter image description here

Upvotes: 1

Related Questions