使用常规的前pression MM上午或下午格式:验证的时间HH [英] validation for Time HH:MM am or pm Format using regular expression

查看:132
本文介绍了使用常规的前pression MM上午或下午格式:验证的时间HH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的web应用程序使用asp.net用vb code工作。

I am working on web application using asp.net with vb code.

我有时间字段一个文本框为此我经常使用前pression验证。

I have a textbox for time field for which i am using regular expression validator.

我想格式为HH:MM上午。我使用的是常规的前pression是(0 [1-9] | [1] [0-2])[:]+(0 [0-9] | [ 1-5] [0-9])[] [A | A | P | P] [M | M]。

the format i want is HH:MM am. the regular expression i am using is "(0[1-9]|[1][0-2])[:]" + "(0[0-9]|[1-5][0-9])[ ][A|a|P|p][M|m]"

我正在进入的时间,例如:08:30上午或下午8时三十,但经常前pression是显示错误消息

i am entering the time example: 08:30 AM or 08:30 PM but the regular expression is showing error message.

谁能帮我用正确的正前pression。

Can anyone help me with correct regular expression.

所有三江源提前

shubha

推荐答案

使用RegularEx pressionValidator及以下ValidationEx pression。我已经使用了。

Use RegularExpressionValidator and below ValidationExpression. I have used that.

ValidationExpression="^(1[0-2]|0[1-9]):[0-5][0-9]\040(AM|am|PM|pm)$"

这篇关于使用常规的前pression MM上午或下午格式:验证的时间HH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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