通过后面的代码验证表达式 [英] validation expression through code behind

查看:63
本文介绍了通过后面的代码验证表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用多行文本框&通过web.config文件配置的两个案例ID之间的传递案例ID(如1660,1713)也采用特殊格式,即(,). 为此,我是
中的代码

using multiline text box & pass case id like 1660,1713 in this format also special character i.e (,) between two case id configure through web.config file .
for that i am code in

string s1, s2
 s1 = @"^\d*[0-9](|";
       s2 = @"|\s)\d*[0-9]*$";

     string regx = s1 + Functions.ToString(ConfigurationManager.AppSettings["BulkCaseSeparator"].ToString() + s2);

       RegularExpressionValidator1.ValidationExpression = regx;  


当我在1660,1713之类的多行文本框中传递值但不适用于1617,1700,1415时也工作正常,也不适用于1617,1700,1415(这第一行中的这三个),1713(它在第二行中) ).


it is working fine when i am pass value in multiline text box like 1660,1713 but not working for 1617,1700,1415 also not working for 1617,1700,1415(this three on first line),1713(it is on second line). what can do for this scenario using above code.

推荐答案

; 字符串regx = s1 + Functions.ToString(ConfigurationManager.AppSettings ["BulkCaseSeparator"].ToString()+ s2); RegularExpressionValidator1.ValidationExpression = regx;
"; string regx = s1 + Functions.ToString(ConfigurationManager.AppSettings["BulkCaseSeparator"].ToString() + s2); RegularExpressionValidator1.ValidationExpression = regx;


当我在1660,1713之类的多行文本框中传递值但不适用于1617,1700,1415时也工作正常,也不适用于1617,1700,1415(这第一行中的这三个),1713(它在第二行中) ).使用上面的代码在这种情况下可以做什么?


it is working fine when i am pass value in multiline text box like 1660,1713 but not working for 1617,1700,1415 also not working for 1617,1700,1415(this three on first line),1713(it is on second line). what can do for this scenario using above code.




正则表达式可通过Expresso(来自
的免费工具)轻松进行设置和测试 http://www.ultrapico.com/Expresso.htm [
Hi,

Regular Expressions are easily set up and tested with Expresso, a free tool from
http://www.ultrapico.com/Expresso.htm[^]

its Help u a Lot

Best Luck
Happy Coding :)


这篇关于通过后面的代码验证表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆