小编bea*_*boy的帖子

Notepad ++多次修改具有相同字符串和附加文本的字符串

在下面的线程上提出了一个类似的问题,我能够让它部分工作 Notepad++ 在常量字符串中查找和替换 不想创建一个新问题,因为想通过在评论中询问来寻求一些帮助,但我的声誉是少所以必须创建一个新问题。

我有一个格式的文本文件,其中重复了以下示例多次

this is random text
https://helloworld.com

another random text
https://iamdoinggood.com

more random text
https://howareyou.com
Run Code Online (Sandbox Code Playgroud)

问题是仅将以 https:// 开头的字符串替换为类似

this is random text
<span"><a href="https://helloworld.com">https://helloworld.com</a></span><br />

another random text
<span"><a href="https://iamdoinggood.com">https://iamdoinggood.com</a></span><br />

more random text
<span"><a href="https://howareyou.com">https://howareyou.com</a></span><br />
Run Code Online (Sandbox Code Playgroud)

我尝试使用 find 和替换正则表达式勾选来执行此操作,使用命令

——([https].*)

替换——<span"><a href="\1">\1</a></span><br />

但它不仅修改以 https:// 开头的字符串,还修改其他文本并给出如下结果,即混淆正常文本的某些部分,并向其添加额外的 html 标签,这是不打算的

this is random text
<span"><a href="https://helloworld.com">https://helloworld.com</a></span><br />

ano<span"><a href="ther random text">ther random text</a></span><br />
<span"><a href="https://iamdoinggood.com">https://iamdoinggood.com</a></span><br />

more random <span"><a href="text">text</a></span><br />
<span"><a href="https://howareyou.com">https://howareyou.com</a></span><br …
Run Code Online (Sandbox Code Playgroud)

notepad++ regex

2
推荐指数
1
解决办法
245
查看次数

标签 统计

notepad++ ×1

regex ×1