I should have read the rest of your question.. I think you'll have to do it multiple times since it's not a blanket replace.. but maybe someone else has another idea
On Fri, Nov 4, 2011 at 9:34 AM, Greg Morphis <gmorp...@gmail.com> wrote: > rereplace(string, "[^a-zA-Z0-9-_]", "", "all") > > On Fri, Nov 4, 2011 at 9:30 AM, Dennis Belmont > <membersh...@dennisbelmont.com> wrote: >> >> I'd like to create a function that reviews a string and replaces all >> characters that aren't alphanumeric, or a dash or underscore. These will >> generally be short strings, and the function will be used for things like >> creating friendly page names from navigation text. >> >> Some characters would be converted to specific things (spaces to dashes or >> underscores, ampersands to the word "and", etc. ) - that's the easy part >> because I can look for specific ASCII characters and use Replace() - but >> most will simply be dropped. >> >> For example: >> >> navigation text examples = >> >> "How Do I Join?*" >> The "Final Word" >> R&D >> >> desired converted strings = >> >> How-Do-I-Join >> The-Final-Word >> R-and-D >> >> I thought about looping the strings as a list using spaces as a delimiter, >> then replacing anything that isn't in a specific ascii range (the letters >> and numbers), but since I have to look at every character in the string that >> doesn't work. >> >> There's got to be an easier way than doing a replace for every possible >> ASCII, right? >> >> Thanks in advance for any input! >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348433 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm