Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
76
rated 0 times [  77] [ 1]  / answers: 1 / hits: 28352  / 14 Years ago, tue, september 28, 2010, 12:00:00

I want to remove all special characters (,/{}etc.) from an input field being saved as a string to the DB.



What is the best approach?



Should this check be tackled with JS, ColdFusion or Microsoft SQL - Maybe all three?



How would I go about coding this using ColdFusion or Microsoft SQL?


More From » sql

 Answers
88

You mean everything not alphanumeric?



I'd probably use a REReplace in the data layer.



<cfqueryparam 
cfsqltype=cf_sql_varchar
value=#REReplace(myVar,[^0-9A-Za-z ],,all)#
/>


Update: changed to include space.


[#95474] Saturday, September 25, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
theodore

Total Points: 318
Total Questions: 97
Total Answers: 119

Location: Turks and Caicos Islands
Member since Sun, Mar 7, 2021
3 Years ago
;