当前位置:网站首页>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
边栏推荐
- XSS challenges绕过防护策略进行 XSS 注入
- 华为、H3C、思科命令对比,思维导图形式从基础、交换、路由三大方向介绍【转自微信公众号网络技术联盟站】
- Which ecology is better, such as Mi family, graffiti, hilink, zhiting, etc? Analysis of five mainstream smart brands
- High number_ Vector algebra_ Unit vector_ Angle between vector and coordinate axis
- 微服务注册与发现
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 15
- Is there a completely independent localization database technology
- codeforces每日5题(均1700)-第六天
- 淘宝焦点图布局实战
- PMP每日一练 | 考试不迷路-7.5
猜你喜欢
RobotFramework入门(二)appUI自动化之app启动
What is the investment value of iFLYTEK, which does not make money?
A doctor's 22 years in Huawei
PMP practice once a day | don't get lost in the exam -7.5
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 14
Solution: attributeerror: 'STR' object has no attribute 'decode‘
ReferenceError: primordials is not defined错误解决
Sign SSL certificate as Ca
Which ecology is better, such as Mi family, graffiti, hilink, zhiting, etc? Analysis of five mainstream smart brands
Maturity of master data management (MDM)
随机推荐
Briefly describe the implementation principle of redis cluster
Looking at the trend of sequence modeling of recommended systems in 2022 from the top paper
Self made CA certificate and SSL certificate using OpenSSL
ReferenceError: primordials is not defined错误解决
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 12
Blue Bridge Cup group B provincial preliminaries first question 2013 (Gauss Diary)
Maturity of master data management (MDM)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 13
High number_ Vector algebra_ Unit vector_ Angle between vector and coordinate axis
Pure QT version of Chinese chess: realize two-man, man-machine and network games
Universal crud interface
Reverse repackaging of wechat applet
MySQL advanced notes
【若依(ruoyi)】设置主题样式
tcpdump: no suitable device found
有沒有sqlcdc監控多張錶 再關聯後 sink到另外一張錶的案例啊?全部在 mysql中操作
How to read excel, PDF and JSON files in R language?
A copy can also produce flowers
A doctor's 22 years in Huawei
js 正则过滤和增加富文本中图片前缀