I'm using Classic ASP, and pulling back the value of a users name from a form and assigning it to a local variable. I would like a way to parse the content and remove special characers such as ',+,@,!,- etc.
usrfname = Replace(Request.Form("FirstName"), "'", "")
I was able to use the above example to remove the ', but I would like to be able to remove multiple different characters as indicated above.
Best Answer
Most simply, you can just chain replaces to keep removing the characters you don't want:
etc.
If you wanted a more elegant solution you could use a regular expression object. If you want to strip out everything apart from alpha-numeric characters, try:
If that isn't quite what you're after then you can alter the regex to suit your exact requirements.