当前位置:网站首页>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
边栏推荐
- 07 singleton mode
- Dachang image library
- [ruoyi] set theme style
- High number_ Vector algebra_ Unit vector_ Angle between vector and coordinate axis
- Atcoder beginer contest 233 (a~d) solution
- How to improve the enthusiasm of consumers when the member points marketing system is operated?
- Yyds dry inventory comparison of several database storage engines
- Briefly describe the implementation principle of redis cluster
- Communication between microservices
- Microservice registration and discovery
猜你喜欢
Force buckle 146 LRU cache
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 11
Pure QT version of Chinese chess: realize two-man, man-machine and network games
MySQL advanced notes
GifCam v7.0 极简GIF动画录制工具中文单文件版
1. Dynamic parameters of function: *args, **kwargs
Referenceerror: primordials is not defined error resolution
【指针训练——八道题】
微软语音合成助手 v1.3 文本转语音工具,真实语音AI生成器
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18
随机推荐
Redis delete policy
Rust language -- iterators and closures
MySQL winter vacation self-study 2022 11 (7)
Technology sharing | what if Undo is too big
有沒有sqlcdc監控多張錶 再關聯後 sink到另外一張錶的案例啊?全部在 mysql中操作
Is there a case where sqlcdc monitors multiple tables and then associates them to sink to another table? All operations in MySQL
codeforces每日5题(均1700)-第六天
2345文件粉碎,文件强力删除工具无捆绑纯净提取版
MySQL winter vacation self-study 2022 11 (5)
2345 file shredding, powerful file deletion tool, unbound pure extract version
Microservice registration and discovery
MySQL winter vacation self-study 2022 11 (8)
Dachang image library
【Unity3D】GUI控件
How does yyds dry inventory deal with repeated messages in the consumption process?
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 17
07 singleton mode
tcpdump: no suitable device found
一个复制也能玩出花来
Installation and use tutorial of cobaltstrike-4.4-k8 modified version