Just Code‎ > ‎

Vb.Net - Regex Whitelist exclusion, string cleanup

posted Feb 14, 2010, 4:02 AM by Peter Henell
Private Function removeInvalidCharacters(ByVal input As String) As String
'+*****************************************************************************
' Purpose: Tar bort alla tecken som inte ?r till?tna (whitelist exclusion)
'
' Assumes: Inget.
' Effects: Inget.
' Input: Den str?ng som skall rensas.
' Output: Den rensade str?ngen.
' Comment: Till?tna tecken ?r: bokst?ver, siffor, punkt och mellanslag.
' Author: Peter Henell 2006
'+*****************************************************************************

Dim retur As String
retur
= System.Text.RegularExpressions.Regex.Replace(input, "[^a-?A-?0-9\.\s]", "")
removeInvalidCharacters
= retur
End Function
Comments