正则表达式 判断 ip:端口 形式
<html>
<head>
</head>
<body> ip:port<input type="" name="zhzh" placeholder="ip:port" id="zhzh">
<button onclick="btn()" value="submit">test</button> <script type="text/javascript">
ip_ip = '(25[0-5]|2[0-4]\\d|1\\d\\d|\\d\\d|\\d)';
ip_ipdot = ip_ip + '\\.';
ip_port = '(:(\\d\\d\\d\\d|\\d\\d\\d|\\d\\d|\\d))?';
isIPaddress = new RegExp('^'+ip_ipdot+ip_ipdot+ip_ipdot+ip_ip+ip_port+'$');
function btn(){
var inputValue=document.getElementById("zhzh").value;
if (!isIPaddress.test(inputValue)) {
console.log("wrong");
}
}
//10.10.117.119
</script>
</body>
</html>
正则表达式 判断 ip:端口 形式的更多相关文章
- C# 正则表达式判断IP,URL等及其解释
C# 正则表达式判断IP,URL等及其解释 判断IP格式方法: public static bool ValidateIPAddress(string ipAddress) { Regex valid ...
- 正则表达式 判断IP 数字
1.正则表达式 public static bool checkIP(string strIP) { //string regex = @"^(2[0-4]\d | 25[0-5] | [0 ...
- 正则表达式判断ip地址
html: <div class="configuration"><form action="" name="myformcon&q ...
- js常用正则表达式判断
1.判断IP:端口 <html> <head> </head> <body> ip:port<input type="" na ...
- 正则表达式检测IP地址与端口号是否合法
正则表达式检测IP地址与端口号是否合法,代码如下: 正则表达式检测IP地址 public static bool CheckAddress(string s) { bool isLegal = fal ...
- QT正则表达式---针对IP地址
判断合法IP的QT正则表达式: bool IsIPaddress(QString ip) { QRegExp rx2("(//d+)(//.)(//d+)(//.)(//d+)(//.)(/ ...
- iptraf 网卡 ip 端口 监控 netstat 关闭端口方法
18 commands to monitor network bandwidth on Linux server – BinaryTides https://www.binarytides.com/l ...
- android 登录和设置IP/端口功能
本人第一个Android开发功能:登录以及设置IP/端口. 本人是j2ee开发工程师,所以这个可能有一些处理不太完善的地方,欢迎评论在下面,我会认真改进的. 首先是配置strings.xml文件添加用 ...
- Java正则表达式验证IP,邮箱,电话
引言 java中我们会常用一些判断如IP.电子邮箱.电话号码的是不是合法,那么我们怎么来判断呢,答案就是利用正则表达式来判断了,废话不多说,下面就是上代码. 1:判断是否是正确的IP 1 ...
随机推荐
- JS for循环
正常的for循环代码: var arr = ['Apple', 'Google', 'Microsoft']; var i, x; for (i=0; i<arr.length; i++) { ...
- 内存VSS/RSS/PSS/USS名词解释
VSS(virtual set size)虚拟耗用内存(包含共享库占用的内存) RSS(Resident set size)实际使用物理内存(包含共享库占用的内存) RSS是进程实际驻存在物理内存的部 ...
- ASP.NET 身份认证
ASP.NET 身份认证相关 原理 ASP.NET中身份认证分为两个阶段:认证与授权 1. 认证:识别当前请求的用户是不是一个可识别(登录)用户.AuthenticateRequest 2. 授权:是 ...
- linux下配置yun源
备份原yum源 /etc/yum.repos.d/centos一base.repo 下载yum源 wagt 源网址/源名称/etc/yum.repos.d/原yum名
- UML大战需求分析--阅读笔记3
这次阅读的是第四章,流程分析利器之 – 活动图.对需求有两种分析的方式:结构建模与行为建模.活动图是行为建模中经常使用的一种图.由流程图发展而来. 活动图中有一些名词:开始状态.结束状态.活动.判断. ...
- 深入分析HTTP状态码502(nginx+php-fpm)
我们的一个web项目,由于新上城市增多,导致访问量增大,DB压力增大,作为提供接口的业务方,最近被下游反馈大量请求"502". 502,bad gateway,一般都是upstre ...
- 5天揭秘js高级技术-第一天
一.基础杂记 1. document.write() <script type="text/javascript"> document.write('<h2> ...
- MFC下打开选择文件夹并获取文件夹的绝对路径
http://blog.csdn.net/w18758879921/article/details/51613382 http://www.cnblogs.com/greatverve/archive ...
- [IOS]JSPatch
用途 修复线上出现的紧急crash,热更新 例子 demo 原理解读 在程序didFinishLaunch时候执行,[JPEngine startEngine], startEngine做了对解析js ...
- codeforces 459E
codeforces 459E E. Pashmak and Graph time limit per test 1 second memory limit per test 256 megabyte ...