madanthrax
IS-IT--Management
Hi,
Some time ago I stored away some code posted by Tarwn in a reply, thinking I might need it one day.
This works fine for deleting individual characters from form input strings (although I have no idea why there are two slashes in the Pattern).
I am a Regex newbie but after an js/iframe/injection attack on my website I have been experimenting with the pattern unsucessfully to delete multiple character substrings such as occurences of http:// and .js.
My objective is to filter out several individual characters and these two substrings from user form text inputs. The script above seems so simple but the Regex help websites are so complicated in respect to patterns.
Am I starting from the wrong end or is there a way to include substrings in the regex pattern?
Thanks for any help,
Anthony
Some time ago I stored away some code posted by Tarwn in a reply, thinking I might need it one day.
Code:
dim teststring
teststring = "this is a test: slash\ bracket{ bracket} singlequote' lparen( rparen) whee"
Response.Write "teststring Unchanged is: " & teststring & "<br/>"
Response.Write "teststring Changed is: " & DeleteChars(teststring)
Function DeleteChars(str)
Dim regex
Set regex = New RegExp
regex.Pattern = "([\\{}'()])"
regex.Global = True
DeleteChars = regex.Replace(str,"")
Set regex = Nothing
End Function
I am a Regex newbie but after an js/iframe/injection attack on my website I have been experimenting with the pattern unsucessfully to delete multiple character substrings such as occurences of http:// and .js.
My objective is to filter out several individual characters and these two substrings from user form text inputs. The script above seems so simple but the Regex help websites are so complicated in respect to patterns.
Am I starting from the wrong end or is there a way to include substrings in the regex pattern?
Thanks for any help,
Anthony
[sub]"Nothing is impossible until proven otherwise"[/sub]