惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 聂微东
月光博客
月光博客
博客园 - 司徒正美
爱范儿
爱范儿
aimingoo的专栏
aimingoo的专栏
量子位
Recent Announcements
Recent Announcements
V
V2EX
P
Proofpoint News Feed
小众软件
小众软件
云风的 BLOG
云风的 BLOG
腾讯CDC
宝玉的分享
宝玉的分享
Microsoft Azure Blog
Microsoft Azure Blog
大猫的无限游戏
大猫的无限游戏
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
B
Blog
博客园_首页
GbyAI
GbyAI
博客园 - Franky

博客园 - Danys

Ubuntu10.10 安装 Discuz 在Windows 7 的Windows Virtual PC上装 Ubuntu 10.10 使用Carbide.c++搭建S60开发环境 手机开发入门系列 主流智能手机操作系统知多少 VB.NET 转换为 C# ASP.NET 开源 Blog 收集 Vista SP1、VS2008 SP1环境中 localhost无法访问 Vista SP1下,IE8,使用支付宝 C# 写文本文件 C#读取文本文件 【翻译】Technical Overview of DirectAccess in Windows 7 and Windows Server 2008 R2 Silverlight 2 相关资源下载地址 C#读取Excel方法总结 11款完全免费的Web设计工具 Elcomsoft宣称WPA/WPA2无线加密破解速度提高100倍 Microsoft Silverlight 2 正式版本发布 NET 4.0将包含并行扩展 13个大文件邮件传送服务
验证时间的正则表达式
Danys · 2009-09-24 · via 博客园 - Danys

能验证如下格式:

12:30、12:3、12:03、1:03、01:03

JavaScript代码为:

var regexObj= /^((2[0-3])|([0-1][0-9])):[0-5]?[0-9]$/;

alert(regexObj.test("12:20"));

alert(regexObj.test("12:2"));

alert(regexObj.test("12:)"));

alert(regexObj.test("12:d"));

alert(regexObj.test("12:0"));

alert(regexObj.test("12:03"));

alert(regexObj.test("1:03"));

alert(regexObj.test("01:03"));

C#的代码类似,这里就不说了~