Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
The following code example uses the static Regex.Replace method to strip invalid characters from a string. You can use the CleanInput method defined here to strip potentially harmful characters that have been entered into a text field in a form that accepts user input. CleanInput returns a string after stripping out all nonalphanumeric characters except @, - (a dash), and . (a period).
Example
Function CleanInput(strIn As String) As String
' Replace invalid characters with empty strings.
Return Regex.Replace(strIn, "[^\w\.@-]", "")
End Function
String CleanInput(string strIn)
{
// Replace invalid characters with empty strings.
return Regex.Replace(strIn, @"[^\w\.@-]", "");
}