Re: Regex.Replace

Tech-Archive recommends: Fix windows errors by optimizing your registry



system.Text.RegularExpressions.Regex.Replace

cj wrote:
I just ran across this in the VB help. Sounds perfect. Only they don't tell me what namespace must be imported to use regex. I guess that's the problem cause I pasted this into a test program and it tell me Regex is not declared.

Function CleanInput(ByVal strIn As String) As String
' Replace invalid characters with empty strings.
Return Regex.Replace(strIn, "[^\w\.@-]", "")
End Function
.



Relevant Pages

  • Re: VB vs C#
    ... >> A C# developer can use the Microsoft.VisualBasic namespace if they ... > The Find from a string is twice as fast as the indexOf method with a string. ... However that MB find had the same speed as the Regex. ...
    (microsoft.public.dotnet.general)
  • Re: VB vs C#
    ... >> more performance than the single Net namespace. ... The Find from a string is twice as fast as the indexOf method with a string. ... The indexOff however outclassed the Find when it is with a real defined char ... However that MB find had the same speed as the Regex. ...
    (microsoft.public.dotnet.general)
  • Regex.Replace
    ... Only they don't tell me what namespace must be imported to use regex. ... I guess that's the problem cause I pasted this into a test program and it tell me Regex is not declared. ... Function CleanInput(ByVal strIn As String) As String ... ' Replace invalid characters with empty strings. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Fastest way to search a string for the occurance of a word??
    ... but the OP's question was what's the "Fastest way to search a string ... in all the tests I did here, the Regex was by far superior. ... However, of course, if you've got new regular expressions all ... Sure - but just that extra Match object could be relevant if the search ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: regular expression help
    ... Basically because if you remove everything that is optional in the regex below you end up with an empty regex: ... So the regex engine will try to match on every character in the string: ... , comma doesn't match, but the nothingness in front of it does. ... A quote followed by any sequence of characters that is not a quote, ...
    (microsoft.public.dotnet.framework)