当前位置:网站首页>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
边栏推荐
- PMP每日一练 | 考试不迷路-7.5
- "Hands on learning in depth" Chapter 2 - preparatory knowledge_ 2.3 linear algebra_ Learning thinking and exercise answers
- CSP numeric sort
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 11
- Master data management theory and Practice
- 技术分享 | undo 太大了怎么办
- C语言sizeof和strlen的区别
- Déduisez la question d'aujourd'hui - 729. Mon emploi du temps I
- Briefly describe the implementation principle of redis cluster
- 主数据管理理论与实践
猜你喜欢
Fault analysis | analysis of an example of MySQL running out of host memory
微软语音合成助手 v1.3 文本转语音工具,真实语音AI生成器
【 kubernets series】 a Literature Study on the Safe exposure Applications of kubernets Service
RobotFramework入门(三)WebUI自动化之百度搜索
微服务注册与发现
主数据管理理论与实践
[postgraduate entrance examination English] prepare for 2023, learn list5 words
Pure QT version of Chinese chess: realize two-man, man-machine and network games
[network security interview question] - how to penetrate the test file directory through
Microservice registration and discovery
随机推荐
2020.02.11
Httprunnermanager installation (III) - configuring myql Database & initialization data under Linux
[matlab] access of variables and files
Looking at the trend of sequence modeling of recommended systems in 2022 from the top paper
力扣今日题-729. 我的日程安排表 I
"Hands on learning in depth" Chapter 2 - preparatory knowledge_ 2.5 automatic differentiation_ Learning thinking and exercise answers
【若依(ruoyi)】启用迷你导航栏
MySQL learning notes-10-tablespace recycling
Introduction to robotframework (I) brief introduction and use
ReferenceError: primordials is not defined错误解决
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 6
JS events (add, delete) and delegates
Apt installation ZABBIX
QT release exe software and modify exe application icon
2345 file shredding, powerful file deletion tool, unbound pure extract version
I changed the driver to 5.1.35, but it is still the same error. I can succeed even now, but I will report this every time I do an SQL operation
DDoS "fire drill" service urges companies to be prepared
Thinking on Architecture Design (under continuous updating)
Bigder: I felt good about the 34/100 interview, but I didn't receive the admission
#PAT#day10