Home All Groups Group Topic Archive Search About

only letters or numbers

Author
26 Mar 2006 10:56 PM
rodchar
hey all,

given a string, if i only wanted to get only letters and number (no symbols)
is there a function to do this?
i.e.
"Los Angeles, CA"
i don't want the comma.

thanks,
rodchar

Author
27 Mar 2006 4:09 AM
Ken Tucker [MVP]
Hi,

        Use a regular expression.

Dim regText As New System.Text.RegularExpressions.Regex("^[a-zA-Z0-9]+$ ")

Trace.WriteLine(regText.IsMatch("Los Angeles, CA"))




http://regexlib.com/Search.aspx?k=alphanumeric

Ken
---------------
Show quoteHide quote
"rodchar" <rodc***@discussions.microsoft.com> wrote in message
news:7E732089-2285-4057-887A-DD86A729FABF@microsoft.com...
> hey all,
>
> given a string, if i only wanted to get only letters and number (no
> symbols)
> is there a function to do this?
> i.e.
> "Los Angeles, CA"
> i don't want the comma.
>
> thanks,
> rodchar