当前位置:网站首页>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
边栏推荐
- Zhang Lijun: penetrating uncertainty depends on four "invariants"
- How to accurately identify master data?
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 21
- 深度解析链动2+1模式,颠覆传统卖货思维?
- 原型图设计
- 4. File modification
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 6
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 12
- Microsoft speech synthesis assistant v1.3 text to speech tool, real speech AI generator
- [Digital IC manual tearing code] Verilog asynchronous reset synchronous release | topic | principle | design | simulation
猜你喜欢
Apt installation ZABBIX
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 6
力扣今日题-729. 我的日程安排表 I
Introduction to robotframework (II) app startup of appui automation
[ruoyi] set theme style
Reverse repackaging of wechat applet
MySQL winter vacation self-study 2022 11 (9)
【Unity3D】GUI控件
"Hands on learning in depth" Chapter 2 - preparatory knowledge_ 2.5 automatic differentiation_ Learning thinking and exercise answers
[Digital IC manual tearing code] Verilog asynchronous reset synchronous release | topic | principle | design | simulation
随机推荐
"Hands on learning in depth" Chapter 2 - preparatory knowledge_ 2.5 automatic differentiation_ Learning thinking and exercise answers
Introduction to robotframework (II) app startup of appui automation
Solve 9 with C language × 9 Sudoku (personal test available) (thinking analysis)
Large scale DDoS attacks take Myanmar offline
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 15
Self made CA certificate and SSL certificate using OpenSSL
Which ecology is better, such as Mi family, graffiti, hilink, zhiting, etc? Analysis of five mainstream smart brands
米家、涂鸦、Hilink、智汀等生态哪家强?5大主流智能品牌分析
Misc (eternal night), the preliminary competition of the innovation practice competition of the National College Students' information security competition
Redis skip table
Apt installation ZABBIX
[unity3d] GUI control
tcpdump: no suitable device found
DDoS "fire drill" service urges companies to be prepared
Master data management theory and Practice
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 21
张丽俊:穿透不确定性要靠四个“不变”
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 10
The difference between sizeof and strlen in C language
A doctor's 22 years in Huawei