编程开发中常用的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] 濠电偞鍨堕幐鎼佀囬柆宥呮槬鐎广儱顦粈鍌炴倵閿濆骸浜濋柣鎺戞健閺屻劌鈽夐搹顐㈩伓闂備胶枪缁绘劙鎮ч幘姹団偓鍌烆敃閿曗偓缁€鍡涙煥閻曞倹瀚�闂備焦瀵х粙鎴﹀嫉椤掑倻鐜婚柟閭﹀枓閸嬫挾鎲撮崟顓犵暤闂侀潧娲らˇ鐢稿箖椤曗偓椤㈡洟顢楅崒婊庢Х濠电偛鐡ㄧ划鐘诲礂濞戞氨绠旈柕蹇嬪€曢悿顕€鏌涢埄鍐炬畼闁告ɑ妫冮弻銊モ槈濡粯鎷遍柣搴㈡皑閸嬫挸顕ラ崟顐僵妞ゆ帒顦伴埢鍏肩箾閹寸偞灏ㄩ柛瀣尵缁辨捇宕橀埡浣轰桓婵犫拃宥咁洭濞存粍鎮傞弫鎾绘晸閿燂拷