المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Problem with really simple regex



C# Programming
08-29-2009, 12:40 AM
Okay, I'm obviously missing something simple here. http://www.barakasoft.com/script/Forums/Images/smiley_tongue.gif All I'm trying to do is check a piece of text to ensure that it only contains uppercase letters or numbers.

My snippet looks like this:



System.Text.RegularExpressions.Regex rgxTest = new System.Text.RegularExpressions.Regex("[A-Z0-9]*");

MessageBox.Show(rgxTest.IsMatch("abc_!").ToString());



Can someone please explain to me why this is returning True? And how I fix this? http://www.barakasoft.com/script/Forums/Images/smiley_confused.gif

Thanks!

Tok