function checkDataClude()
{
var data = "1234";
var reCat = /123/gi;
//alert(reCat.test(data));
var match=data.match(reCat);
if (match.length==0)
{
alert("不存在");
}
else
{
alert("存在");
}
}
function getNumStr()
{
var str = "a1b2c3d4e5f6g7h8i9j0k";
var match = str.match(/\d/g);
var msg = [];
for(var i = 0; i < match.length; i++)
{
msg.push(match[i]);
}
alert(msg);//1,2,3,4,5,6,7,8,9,0
}
function getStr1()
{
var data = "123123,213,12312,312,3,Cat,cat,dsfsdfs,";
var reCat = /cat/gi;
var arrMactches = data.match(reCat)
var msg=[];
for (var i=0;i < arrMactches.length ; i++)
{
msg.push (arrMactches[i]);
}
alert(msg);//Cat,cat
}
function getIndex()
{
var str = "a1b2c3d4e5f6g7h8i9j0k";
var match = /c/gi;
alert (str.search(match));//4
}
function getIndex()
{
var str = "a1b2c3d4e5f6g7h8i9j0k";
var match = /c/gi;
alert (str.replace(match,"zjw"));//a1b2zjw3d4e5f6g7h8i9j0k
}
function splitArray()
{
var data = "a=1&b=2&c=3";
var reCat = /\&/;
var arrdata = data.split(reCat);
for (var i = 0; i < arrdata.length; i++)
{
alert(arrdata[i]);//
}
}
function regIsDigit(fData)
{
var reg = new RegExp("^[0-9]$");
alert(reg.test(fData));
}
function regDataLength(fData)
{
var valLength = fData.length;
var reg = new RegExp("^[\u0391-\uFFE5]$");
var result = 0;
for(i=0; i< valLength; i++)
{
if(reg.test(fData.charAt(i)))
{
result += 2;
}
else
{
result ++;
}
}
return result;
}
function regIsNumber(fData)
{
var reg = new RegExp("^[-]?[0-9]+[\.]?[0-9]+$");
//return reg.test(fData)
alert(reg.test(fData));
}
function regIsEmail(fData)
{
var reg = new RegExp("^[0-9a-zA-Z]+@[0-9a-zA-Z]+[\.]{1}[0-9a-zA-Z]+[\.]?[0-9a-zA-Z]+$");
return reg.test(fData);
}
function regIsPhone(fData)
{
var reg = /^(\+86)?(1[0-9]{10})$/;
return reg.test(fData);
}