It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Partner Sites
Board index Programming Visual Basic Forum

Regular Expression

Moderator: dafunkymunky

Regular Expression

Postby jackdarippa on Mon Sep 07, 2009 12:23 pm

Hello all,

I have a problem involving regular expression, i come from a web background and it seems alot easier to use regular expression in those languages. However, what im trying to do is validate a text field. The constraints are: only a-z, both upper and lower case and the value -. (as it can be a dash). Other characters such as ,.&, 123...9 are not allowed. Can anyone help with this.

sample code i am sort of using is: regEx.Pattern = "[a-zA-Z]$"

Can anyone shed some light on this.

Jac
jackdarippa
 
Posts: 4
Joined: Sun Jul 12, 2009 10:24 am

Re: Regular Expression

Postby bytelogik on Sat Oct 17, 2009 2:37 pm

You can use the function IsNumeric which takes the string as parameter to discard the numeric values. But you will have to check the other symbolic characters one by one.

Also, you can store the values to be discarded into an array and check if anyone of the value is present in the string. This will be much more easier to validate a text string.

Hope this helps.
bytelogik
 
Posts: 7
Joined: Tue Oct 06, 2009 8:24 pm


Return to Visual Basic Forum

Who is online

Users browsing this forum: No registered users and 1 guest