js常用正则

1、验证ip

function isIp(ip){
    return /^(([01]?\d\d?|2[0-4]\d|25[0-5])\.){3}([01]?\d\d?|2[0-4]\d|25[0-5])(\/(0?[1-9]|[12]\d|3[01]))?$/.test(ip);
}

  

posted @ 2015-07-31 15:02  junjieok  阅读(258)  评论(0编辑  收藏  举报