当前位置:网站首页>JS regular filtering and adding image prefixes in rich text
JS regular filtering and adding image prefixes in rich text
2022-07-06 02:49:00 【Residual temperature without trace】
1、 Filter image prefixes without '/', Become a relative path , The following two regularities are ok , Personal test
// Example , Filter image prefixes without '/', Become a relative path
console.log('valueHtml', valueHtml.replace(/https?:\/\/[^\/]*(\/)*/g, ''));
console.log('valueHtml', valueHtml.replace(/\bhttps?:\/\/(.*?)\/+/ig, ''));
2、 Add picture prefix
valueHtml= result.detail.content.replace(/<img [^>]*src=['"]/g, `<img src="${ Your domain name }`)
Reference material : Use regular expressions to add domain names to rich text image labels for display 、 Delete domain name submission _qq_43675010 The blog of -CSDN Blog
边栏推荐
- JS events (add, delete) and delegates
- Function knowledge points
- Communication between microservices
- MySQL winter vacation self-study 2022 11 (8)
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18
- PMP每日一练 | 考试不迷路-7.5
- Taobao focus map layout practice
- Httprunnermanager installation (III) - configuring myql Database & initialization data under Linux
- 【指针训练——八道题】
- 2345文件粉碎,文件强力删除工具无捆绑纯净提取版
猜你喜欢
【Unity3D】GUI控件
Gifcam v7.0 minimalist GIF animation recording tool Chinese single file version
Universal crud interface
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 23
有没有完全自主的国产化数据库技术
全国大学生信息安全赛创新实践赛初赛---misc(永恒的夜)
不赚钱的科大讯飞,投资价值该怎么看?
Solution: attributeerror: 'STR' object has no attribute 'decode‘
RobotFramework入门(三)WebUI自动化之百度搜索
Sign SSL certificate as Ca
随机推荐
Redis installation
Prototype design
Qt发布exe软件及修改exe应用程序图标
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8
[Digital IC manual tearing code] Verilog asynchronous reset synchronous release | topic | principle | design | simulation
技术分享 | undo 太大了怎么办
MySQL advanced notes
RobotFramework入门(二)appUI自动化之app启动
Fault analysis | analysis of an example of MySQL running out of host memory
Solution: attributeerror: 'STR' object has no attribute 'decode‘
Spherical lens and cylindrical lens
华为、H3C、思科命令对比,思维导图形式从基础、交换、路由三大方向介绍【转自微信公众号网络技术联盟站】
Summary of Bible story reading
js 正则过滤和增加富文本中图片前缀
CSP date calculation
[matlab] access of variables and files
球面透镜与柱面透镜
【Unity3D】GUI控件
Universal crud interface
Six stone management: why should leaders ignore product quality