I'm not an expert with Regex, but you could do this:

<cfset finalDescription =
replace(replace(replace(trim(form.description),"<br>","<br/>","all"),"<p></p
>","<br /><br />","all"),"<p>","<br /><br />","all") >

Again, this is not regex, but it is a much more simplified (and faster I
believe) way of doing the same thing with 1 line of code.

Dave Phillips
-----Original Message-----
From: Che Vilnonis [mailto:ch...@asitv.com] 
Sent: Thursday, August 13, 2009 1:14 PM
To: cf-talk
Subject: Regex Help - Can this be simplified?


Is there a way using CF's Regex functions to simplfy the lines of code below
into one line? Some kind of built in regex list comparison maybe?

<cfset finalDescription = replace(trim(form.description), "<br>", "<br />",
"ALL")>
<cfset finalDescription = replace(finalDescription, "<p></p>", "<br /><br
/>", "ALL")>
<cfset finalDescription = replace(finalDescription, "<p>", "<br /><br />",
"ALL")>

Thanks, CV



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325436
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to