js使用正则表达式判断ip地址 2015/02/26 15499 <script type="text/javascript"> var ip='20.255.255.255'; re=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/ r=re.test(ip); alert(r) </script>