>> mystring = > rereplace(mystring,"[#chr(1)#-#chr(8)##chr(11)#-#chr(12)## > chr(14)#-#chr(31)#]","","ALL");
> The only problem with this is that that you have to add > stuff that you want > removed. > You could also list what's allowed, vs. what's not > allowed, like > <cffunction name="safeString" returntype="string" > output="false"> > <cfargument name="stringToClean" required="true" > type="string"> > <cfreturn > rereplacenocase(stringToClean,'[^a-z|A-Z|0-9|_]','','all') > > > </cffunction> > Which you never need to add to unless you need to add to > it, so to speak. > Only useful if you don't know before hand what's gonna get > entered i > guess... um... :-P Whatever. I go now. > :Den Heh... Well, there is that. :) The reason why I went with the removal of characters that aren't allowed in XML is because most punctuation marks and unicode characters above Z, including both accented lattin characters (umlauts, etc) and non-latin characters such as Kanji are also allowed. I was trying to ensure a solution which would work universally, and so I didn't want to inadvertently remove any character that would be legal. Incidentally, you only need to specify a-z or A-Z when using rereplacenocase -- if using rereplace then you need both) -- also the | characters aren't necessary within the character class denoted with [] and actually will behave differently because it's not a special character in that context. In this expression it will allow | characters in the list of characters not removed, as opposed to separating sub-expressions, which is what the | character does within parenthesis (each pair of which represent one or more subexpressions, separated by pipes, i.e. (mary|joe) matches either "mary" or "joe"). So, rereplacenocase(string,'[^a-z0-9_]','','all') will have the effect you intended. Hope that's useful to you. :) s. isaac dealey 434.293.6201 new epoch : isn't it time for a change? add features without fixtures with the onTap open source framework http://www.fusiontap.com http://coldfusion.sys-con.com/author/4806Dealey.htm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237317 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

