本文介绍了如何验证文本框至少有一个字母和一个数字允许一些特殊字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我想验证文本框。 test_100允许 test100允许 test-100_01允许 以上格式是允许的。如果文本框只有符号抛出错误。 我尝试过: 正则表达式正则表达式= 新正则表达式( @ ^ [a-zA-Z0-9,.- \\ -_] * $); if (!regex.Match(textbox1.Text).Success) { Response.Write( 正确输入数字)} i有使用上面的代码。这个方法满足条件但是 - (或)__(或),, 在文本框中输入上面的符号allowed.but我想不允许throw错误消息。解决方案 I want to validate text box.test_100 allowedtest100 allowedtest-100_01 allowedabove format is allowed.if text box have only symbols throw the error.What I have tried: Regex regex = new Regex(@"^[a-zA-Z0-9 ,.-\\-_]*$");if (!regex.Match(textbox1.Text).Success) { Response.Write("Enter number correctly") }i have used above code.this method satisfy the condition but -- (or) __ (or) ,, enter above symbols in textbox allowed.but i want not allow throw error message. 解决方案 这篇关于如何验证文本框至少有一个字母和一个数字允许一些特殊字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-22 21:56