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).
Who is Participating?
dfiala13Connect With a Mentor Commented:
Try this, you need to include all the valid characters in the brackets, and the period is a special character you have to escape it... (as is the hyphen)

jjacksnAuthor Commented:
I would like to use hyphen as well.
jjacksnAuthor Commented:
for future reference, how do I undo the negation?  
pop out the ^


will match any string that has one of the characters in brackets
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.