有关正则表达式的研究
2010-10-08 16:48
323 查看
var regexpress = "^[1-9]\\d*$";
var yesno= (new RegExp(regexpress, "")).test("要验证的值");
另一种正则使用方法
if(/^1[0-9]{10}$/.test(mobile))
{
$('sp_mobile').innerHTML='';
$('sp_mobile').className="";
ismobile=true;
}else
{
$('sp_mobile').innerHTML='手机格式不正确';
$('sp_mobile').className="red";
ismobile=false;
}
输入长度的判断
var yesno= (new RegExp(regexpress, "")).test("要验证的值");
另一种正则使用方法
if(/^1[0-9]{10}$/.test(mobile))
{
$('sp_mobile').innerHTML='';
$('sp_mobile').className="";
ismobile=true;
}else
{
$('sp_mobile').innerHTML='手机格式不正确';
$('sp_mobile').className="red";
ismobile=false;
}
if(/^[-]?\d+$/.test(pricemin)||pricemin=='') { ispricemin=true; } else { $('sp_allowprice').innerHTML='请输入整数'; ispricemin=false; }
输入长度的判断
if (jQuery("#Words").val().replace(/[^\x00-\xff]/g, "**").length > 500) { alert("最多输入250个汉字"); return; }
相关文章推荐
- java正则表达式彻底研究
- 彻底研究正则表达式
- 关于java正则表达式贪婪模式和勉强模式的研究
- PHP中有关正则表达式的函数集锦
- js正则表达式的一些研究,截取两个字符串中间的字符串
- 有关中文的正则表达式
- 有关一些正则表达式的元字符
- 有关正则表达式 测试下
- PHP中有关正则表达式的函数集锦
- 研究正则表达式
- python零碎知识(5):有关正则表达式
- 使用正则表达式获取豆瓣评论全文之研究
- 有关字符串分割的问题(正则表达式)
- 关于java正则表达式非捕获型括号和捕获型括号的研究
- 有关linux 正则表达式的好文章【转】
- PHP中有关正则表达式的函数集锦
- 有关PERL5和正则表达式
- java正则表达式有关通配符
- 彻底研究正则表达式
- 2014/11/2 有关身份证号的正则表达式