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.T ext) == true)
Do I need a carrot before each of those sub groups?
(the code is not working properly).
Regex regex = new Regex("[^[a-z][A-Z][0-9].]
if(regex.IsMatch(txtName.T
Do I need a carrot before each of those sub groups?
(the code is not working properly).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
[A-Za-z0-9\.\-]
will match any string that has one of the characters in brackets
ASKER