Jeff,
First you want to remove all special characters.
Pattern = [^A-Za-z0-9 ]
Then you want to replace spaces with "-", but you don't want double
dashes.
Pattern = \s+
Put it together and this is what you've got.
newString = reReplace(oldString, "[^A-Za-z0-9 ]", "", "all");
newString = reReplace(newString, "\s+", "-", "all");
Robert
-----Original Message-----
From: Jeff Becker [mailto:[EMAIL PROTECTED]
Sent: Monday, January 28, 2008 2:51 PM
To: CF-Talk
Subject: SES UDF
Hi folks,
I'm experimenting with SES URLs for a company Intranet.
Basically I would like to take a string and turn it into alpha-numeric
separated by hyphens.
Therefore,
"This is the headline story!!" = "this-is-the-headline-story"
"Let's not forget about special char$$$$$" =
"lets-not-forget-about-special-char"
"Hyphens as in - should not appear 2 times in a row" =
"hyphens-as-in-should-not-appear-2-times-in-a-row"
Does anyone know if a UDF exists already. I've looked at cflib. I've
played with REReplace, but can't find the correct regular expression to
use.
Thanks to all for any help,
Jeff
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297608
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4