正则函数用法

正则函数match、exec、test、search、replace、split

1、test用法:

检查字符串是否与给定的正则表达式相匹配;

如:

if(/(.*)A(.*)/.test('ABC')){
    alert('匹配')
}else{
    alert('不匹配')
}

 

 

posted @ 2013-02-28 16:13  纳闷儿  阅读(162)  评论(0编辑  收藏  举报