I must be missing something: here is what I have, trying to use a UDF.
The testing file name is ^@#$% $rt4o.txt
When I run it through this code newfile is D:\documents\^@#$%$rt4o.txt
I left the space separate for testing, the space is remove but none of the
other chars are
<CFSCRIPT>
Function removestrangechars(pagestring){
temppage = REReplaceNoCase(pagestring, " ", "", "all");
temppage = ReplaceNoCase(temppage, "[@##$%^&*()]", "",
"all");
return temppage;
}
</CFSCRIPT>
<CFOUTPUT>
<CFSET newfile = getpagename(form.filename)>
<CFSET newfile = "D:\Documents\"& removestrangechars(newfile)>
#newfile#
</CFOUTPUT>
thanks
rodney
-----Original Message-----
From: Raymond Camden [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 17, 2001 2:23 PM
To: CF-Talk
Subject: RE: Regexp
Since CF treats # as a variable marker, you have to escape it. Just use ##
to mean one #.
Also, instead of doing multiple REReplaces, use []s.
Ie, tempstring = REREplace(tempstring,"[ @##etc]","","ALL");
=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia
Email : [EMAIL PROTECTED]
ICQ UIN : 3679482
"My ally is the Force, and a powerful ally it is." - Yoda
> -----Original Message-----
> From: Bruce, Rodney [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 17, 2001 5:13 PM
> To: CF-Talk
> Subject: OT: Regexp
>
>
> I need help with a regexp.
>
> I am trying to remove all special chars from file names.
> I can remove them one at a time like so:
>
> tempstring = REREplace(tempstring, " ", "", "all")
> tempstring = REReplace(tempstring, "@", "", "all")
> etc
>
> but the # errors out.
>
> How can I do this in one pass, if possible?
>
> Thanks for any and all help
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists