subject1
image url follows here
[img]http:f6.abc.com/246421f...
[img]http:f6.abc.com/246421d...
[img]http:f6.abc.com/246421h...
[img]http:f6.abc.com/246421m...
download url follows here
[url]link1[/url]
subject2
image url follows here
[img]http:z.uvw.com/7862252...
[img]http:z.uvw.com/4621017...
[img]http:z.uvw.com/4728212...
[img]http:z.uvw.com/78293.5...
download url follows here
[url]link2[/url]
同样,我有很多块。我只需要一个图像 URL(文件后面紧接着许多图像 URL),第一个图像 URL 最好。这意味着,我需要如下所示的输出
subject1
image url follows here
[img]http:f6.abc.com/246421f...
download url follows here
[url]link1[/url]
subject2
image url follows here
[img]http:z.uvw.com/7862252...
download url follows here
[url]link2[/url]
答案1
答案2
以下是一种方法:
- Ctrl+H
- 找什么:
^(\[img\].+\R)(?1)*
- 用。。。来代替:
$1
- Replace all
解释:
^ : begining of line
( : start group 1
\[img\] : literally [img]
.+ : 1 or more any character but newline
\R : any kind of linebreak (\r, \n, \r\n)
) : end group 1
(?1)* : same pattern that the one is defined in group 1, 0 or more times
请勿检查. matches newline
替代品:
$1 : content of group 1
给定示例的结果:
subject1
image url follows here
[img]http:f6.abc.com/246421f...
download url follows here
[url]link1[/url]
subject2
image url follows here
[img]http:z.uvw.com/7862252...
download url follows here
[url]link2[/url]