asp.net正则表达式 [英] asp.net regular expression
本文介绍了asp.net正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想强制用户在asp.net中以表格形式输入正确的时间.我已经使用过这样的正则表达式:
ValidationExpression="^(d{2})([:])(d{2})([:])(d{2})$">
但是在每种情况下都会出错!请对此提供一些帮助...
I want to force the User to enter the correct time in a form in asp.net. I have Used a regular expression like this :
ValidationExpression="^(d{2})([:])(d{2})([:])(d{2})$">
but in every case it makes an Error ! please some one help with this ...
推荐答案
>
但是在每种情况下都会出错!请对此提供一些帮助...
">
but in every case it makes an Error ! please some one help with this ...
尝试一下:
"(\d{2})([:])(\d{2})([:])(\d{2})
Try this:
"(\d{2})([:])(\d{2})([:])(\d{2})
"
我相信^是一个否定词,表示*不应*长度为2的数字
并用数字表示,您应该使用\
注意:请确保在字符串前使用转义符@,或将\替换为\\
[\ Edit]
"
I believe ^ is a negation, which means it should *not* be a digit of length 2
and to denote digit, you should be using \
Note: Make sure you have an escape @ character before the string, or replace the \ with \\
[\Edit]
这篇关于asp.net正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文