Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cfsearch and weird characters 1

Status
Not open for further replies.

sevex

Programmer
Joined
Sep 18, 2001
Messages
74
Location
CA
I've been finding weird characters in user inputted strings are causing cfsearch to display an ugly coldfusion error. is there any way to parse out any characters other than numbers and letters?
 
How about this:
Code:
<cfset myString = &quot;!@&*()?*@$This is a test 123&quot;>
<cfset myString = ReReplace(myString,&quot;[^aA-zZ,^0-9,^ ]&quot;,&quot;&quot;,&quot;ALL&quot;)>

-- or this will remove the specified characters ---
Code:
<cfset myString = ReReplace(myString,&quot;[$!@&*()?><?##]&quot;,&quot;&quot;,&quot;ALL&quot;)>
 
thanks, that should do the trick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top