tags:

views:

42

answers:

3

Hi:

I am new to Reg Expressions. How can I check if a textbox can only hold Y,y,N,n values, Textbox 2 can only have string "abc" or "cba" What will be the ValidationExpression? I will really appreciate help. Thank you in advance.

+4  A: 

Your first example:

/[YyNn]/

Your other example:

/(abc|cba)/

I recommend reading about regular expressions here: http://perldoc.perl.org/perlretut.html

adamse
+1  A: 

Y|y|N|n for Textbox 1 (abc)|(cba) for Textbox 2

Nestor
+1  A: 

If you are new to regular expressions, may I recommend this? http://code.google.com/p/kiki-re/

It's a regular expressions tester, you write your regex and some text to text it. It's really nice to learn about regexes and to test them too ;).

machielo