Re: Stripping out unwanted characters

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Function StripUnwantedChars(ByVal StringToStrip AsString) AsString
Dim stripped AsString
If StringToStrip <> "" Then
stripped = Regex.Replace(StringToStrip, "<(.|\n)+?>", String.Empty)
Return stripped
Else
Return ""
EndIf
EndFunction

Note : insert all the characters you want to strip inside the quotes.

For example, instead of :
stripped = Regex.Replace(StringToStrip, "<(.|\n)+?>", String.Empty)

use :
stripped = Regex.Replace(StringToStrip, "<!#(.|\n)+?>", String.Empty)





Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"et" <eagletender2001@xxxxxxxxx> wrote in message news:ODVkXK7NGHA.668@xxxxxxxxxxxxxxxxxxxxxxx
How can I strip out unwanted characters in a string before updating the database? For instance,
in names & addresses in our client table, we want only letters and numbers, no punctuation. Is
there a way to do this?




.