It's as simple as:

<cfset str =
reReplace("!@##\$%\^&\*()-+={[}]|\\:;""'<,>\.\?/","_","all")>

Notice I had to escape out the # and " for CF and a few character that
regex use like . and *. It's possible I may have missed one though.

=======================================================================
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc

Email    : [EMAIL PROTECTED]
WWW      : www.camdenfamily.com/morpheus
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, December 06, 2002 11:31 AM
> To: CF-Talk
> Subject: Regular Expression Help
> 
> 
> I am trying to use a regular expression to change all 
> possible special characters in a string to underscores 
> because I am trying to use the string as a variable name.
> 
> Regular expressions are not my specialty and I am running 
> into problems using some characters in my reReplace function.
> 
> Could somebody offer some suggestions on making this work?
> 
> I am needing to replace !@#$%^&*()-+={[}]|\:;"'<,>.?/ plus a 
> blank space, all with the _ character.
> 
> Thanks
> -- Jeff
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Reply via email to