在文本中匹配链接并添加A标签
2023-03-07 09:43:12 时间
(?<!href="|">)(https?:\/\/[\w\-\.!~?&=+\*\'(),\/]+)((?!\<\/\a\>).)*
这个正则可以匹配文本中以http开头的链接, 但是不会匹配那些已经被A标签包围的链接. 测试文本:
Test, Here\'s an interesting in-house litigation position with JPMorgan Chase in New York I thought you might be interested inL http://www.xxx.com/lcdetail.php?akey=e1725 They are not using recruiters to fill this job, so if you are interested you can just apply directly. http://www.xxx.com/lcdetail.php?akey=e1725 Cordially --Harrison
regex101.com 这个网站非常棒, 上面提供正则的测试, 以及非常详细的正则表达式解析和说明.
(?<!href="|">)(https?:\/\/[\w\-\.!~?&=+\*\'(),\/]+)((?!\<\/\a\>).)*
This will detect the links started with "http:" without touching the links already wrapped by A tags. Text for test:
Test, Here\'s an interesting in-house litigation position with JPMorgan Chase in New York I thought you might be interested inL http://www.xxx.com/lcdetail.php?akey=e1725 They are not using recruiters to fill this job, so if you are interested you can just apply directly. http://www.xxx.com/lcdetail.php?akey=e1725 Cordially --Harrison
regex101.com is a wonderful site to test and analyse your regular expressions.
相关文章
- 在 Go 里用 CGO?这 7 个问题你要关注!
- 9款优秀的去中心化通讯软件 Matrix 的客户端
- 求职数据分析,项目经验该怎么写
- 在OKR中,我看到了数据驱动业务的未来
- 火山引擎云原生大数据在金融行业的实践
- OpenHarmony富设备移植指南(二)—从postmarketOS获取移植资源
- 《数据成熟度指数》报告:64%的企业领袖认为大多数员工“不懂数据”
- OpenHarmony 小型系统兼容性测试指南
- 肯睿中国(Cloudera):2023年企业数字战略三大趋势预测
- 适用于 Linux 的十大命令行游戏
- GNOME 截图工具的新旧截图方式
- System76 即将推出的 COSMIC 桌面正在酝酿大变化
- 2GB 内存 8GB 存储即可流畅运行,Windows 11 极致精简版系统 Tiny11 发布
- 迎接 ecode:一个即将推出的具有全新图形用户界面框架的现代、轻量级代码编辑器
- loongarch架构介绍(三)—地址翻译
- Go 语言怎么解决编译器错误“err is shadowed during return”?
- 敏捷:可能被开发人员遗忘的部分
- Denodo预测2023年数据管理和分析的未来
- 利用数据推动可持续发展
- 在 Vue3 中实现 React 原生 Hooks(useState、useEffect),深入理解 React Hooks 的