当前位置:网站首页>js正则表达式匹配ip地址(ip地址正则表达式验证)
js正则表达式匹配ip地址(ip地址正则表达式验证)
2022-07-25 23:02:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
let reg = /https:\/\/.*\.[0-9]{1,4}(:[\w]+)?/g这个正则匹配的结果如下
https://101.122.134.40:8860/aa.bb/aa/ee
> https://10.162.123.40:8860
https://101.122.134.40/aa.bb/aa/ee
> https://101.122.134.40然后替换一下即可
let str = 'https://101.122.134.40:8860/aa.bb/aa/ee'
let reg = /https:\/\/.*\.[0-9]{1,4}(:[\w]+)?/g
str.replace(reg,'www.xxx.com')发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/127898.html原文链接:https://javaforall.cn
边栏推荐
- MathType安装和解决不能Crtl+V的问题
- MathType installation and solution cannot solve the problem of crtl+v
- The difference between "= =" and equals
- Common software shortcuts
- Anaconda~Upload did not complete.
- 第二周学习:卷积神经网络
- 2020-09-17
- Basic knowledge of radar
- Design of regular expressions
- Network Security Learning (XIV) IP protocol
猜你喜欢

Single model common sense reasoning first surpasses human beings! HFL summit openbookqa challenge

Day 3 experiment

单元测试,写起来到底有多痛?

Network Security Learning (XV) ARP

CMU AI PhD first year summary
![[natural language processing] [vector representation] augsbert: improve the data enhancement method of Bi encoders for paired sentence scoring tasks](/img/9a/9bb00abf7804d61d3408143e5e4bda.png)
[natural language processing] [vector representation] augsbert: improve the data enhancement method of Bi encoders for paired sentence scoring tasks

We media people must have four material websites, and don't worry about finding materials anymore

7-1 understand everything

MathType installation and solution cannot solve the problem of crtl+v

Memory paging and tuning, kernel and user space
随机推荐
QT string operation
Hcie is finally in hand, and the road begins
Force deduction solution summary 919 complete binary tree inserter
Design of Butterworth filter and drawing of amplitude frequency characteristic curve
Zero crossing position search of discrete data (array)
Rental experience post
QVariant的使用
Hj9 extract non duplicate integers
Structure principle of micro ball vibration switch with chip
QT Chinese programming encounters c2001 error, prompting "there is a newline character in the constant"
Data filtering of MATLAB
Anaconda~Upload did not complete.
Extended configuration of static routing in the second experiment
【接口性能优化】索引失效的原因以及如何进行SQL优化
Experiment 1, experiment 2 and Experiment 3 of assembly language and microcomputer principle: branch program design / loop program design / subroutine design
Session and cookie, token and storage
Simple setting method of search box
HCIE终到手,路才开始
Day 3 experiment
What is the difference between bio, NiO and AIO?