开发者

RegEx Validations

开发者 https://www.devze.com 2022-12-11 03:24 出处:网络
I am new to Reg Expressions.How can I check if a textbox can only h开发者_Go百科old Y,y,N,n values, Textbox 2 can only have string \"abc\" or \"cba\" What will be the ValidationExpression?

I am new to Reg Expressions. How can I check if a textbox can only h开发者_Go百科old 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.


Your first example:

/[YyNn]/

Your other example:

/(abc|cba)/

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


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


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 ;).

0

精彩评论

暂无评论...
验证码 换一张
取 消