Sir,
I have got a function as below to check user whether input text is a legal words or not , but this function would trim or replace the bad words from input string.
Therefore i just want to match input string in this method (don't want to trim or replace). If it matched with any of these then should throw a message "Special characters not allowed"
Function remove_bad_words(ByVal stringword As String) As String
stringword = stringword.ToUpper
Dim newChars As String
Dim badstuff() As String = {"'", "CREATE", "SELECT", "UNION", "DROP", ";", "--", "INSERT", "DELETE", "TRUNCATE", "XP_", "*", "<", ">", "%", "=", "SCRIPT", "ALERT", "HAVING", "MASTER..XP_CMDSHELL", "XP_STARTMAIL", "XP_SENDMAIL", "SP_MAKEWEBTASK", ".", "-", "=", "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "`", "{", "}", "[", "]", ":", ";", """,""", "/", "<", ">", "?", "|", "\", "\", "open()", "sysopen()", "system()", "<>", "()", "eval()"}
newChars = stringword
For j As Integer = 0 To newChars.Length
For i As Integer = 0 To UBound(badstuff)
newChars = Replace(newChars, badstuff(i), "")
Next
Next
Return Trim(newChars)
End Function