编程开发中常用的javascript正则表达式

添加时间:11-05-22 所属分类:HTML网页,JS语言与代码
  本文在此列举了一些常用于编程开发的使用的javascript正则表达试
[code]/**
* 检查是否为正整数
*/
function isUnsignedInteger(strInteger)
{
var newPar=/^\d+$/
return newPar.test(strInteger);
}

function checkMoney(strValue, strUnit)
{
var testMoney = eval("/^\\d+(\\.\\d{0," + (strUnit.length -1) + "})?$/");
return testMoney.test(strValue);
}[/code]-----------------------------------------------------------------------------------------------------------
[code]/**
* 验证浮点数
*/
function checkTextDataForFLOAT(strValue)
{
var regTextFloat = /^(-)?(\d)*(\.)?(\d)*$/;
return regTextFloat.test(strValue);
}[/code]-----------------------------------------------------------------------------------------------------------
[code]/**
* 验证数字
*/
function checkTextDataForNUMBER(strValue)
{
var regTextNumber = /^(\d)*$/;
return regTextNumber.test(strValue);
}[/code]-----------------------------------------------------------------------------------------------------------
[code]/**
* 验证英文字母,不区分大小写
*/
function checkTextDataForENGLISH(strValue)
{
var regTextEnglish = /^[a-zA-Z]*$/;
return regTextEnglish.test(strValue);
}[/code]-----------------------------------------------------------------------------------------------------------
[code]/**
* 验证大写英文字母
*/
function checkTextDataForENGLISHUCASE(strValue)
{
var regTextEnglishUCase = /^[A-Z]*$/;
return regTextEnglishUCase.test(strValue);
}[/code]-----------------------------------------------------------------------------------------------------------
[code]/**
* 验证小写英文字母
*/
function checkTextDataForENGLISHLCASE(strValue)
{
var regTextEnglishLCase = /^[a-z]*$/;
return regTextEnglishLCase.test(strValue);
}[/code]-----------------------------------------------------------------------------------------------------------
[code]/**
* 验证英文字母和数字,不区分大小写
*/
function checkTextDataForENGLISHNUMBER(strValue)
{
var regTextEnglishNumber = /^[a-zA-Z0-9]*$/;
return regTextEnglishNumber.test(strValue);
}[/code]
  • 2
  • 3
  • 4

前篇:PHP常用字符串正则替换及剖分函数比较 后篇:济南新建小区居委会缺失 落户生育入学难困扰...
发表我的评论


推荐文章   少年智则中国智 厉害了城围联的少年棋手...   砖厂孩子的快乐十年   难以置信,这个摄影师真的拍出了童话!   济南泉水相关的地图收集   86.6%受访家长认为养好孩子陪伴比“砸钱...
随机文章   Ajax内部交流文档   AJAX基础教程   编程开发中常用的javascript正则表达式   JS让你的标题栏<tilte>动起来:左...   复制网页内容时自动加版权信息
广告

其他推荐

因为本站所有内容均转载自其它媒体,本意为公众提供免费服务,但并不代表本网赞同其观点,也不能对其真实性验证负责,如稿件版权单位或个人不想在本网发布,请与我联系,本人会立即将其撤除,谢谢.联系方式:atseashawk@163.com QQ:99289555