Link to home
Start Free TrialLog in
Avatar of jjacksn
jjacksn

asked on

URGENT: Easy Regex Question

I'm missing something here,  I only want to allow alphanumeric characters and the period.  i have the following code

Regex regex = new Regex("[^[a-z][A-Z][0-9].]");
if(regex.IsMatch(txtName.Text) == true)

Do I need a carrot before each of those sub groups?  

(the code is not working properly).
Avatar of jjacksn
jjacksn

ASKER

I would like to use hyphen as well.
ASKER CERTIFIED SOLUTION
Avatar of dfiala13
dfiala13

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jjacksn

ASKER

for future reference, how do I undo the negation?  
pop out the ^

[A-Za-z0-9\.\-]

will match any string that has one of the characters in brackets