我需要补充 <p class="mb-40px">
在没有此标签的每一行的开头。
例如:
<p class="mb-40px">moderniseringen av de omgivande flerfamiljshusen berodde helt på hans vilja.</p>
acţiunile de modernizare a blocurilor din jur depindeau în totalitate de voinţa lui.</p>
the modernization of the surrounding blocks of flats depended entirely on his will.</p>
la modernización de los bloques de pisos circundantes dependía enteramente de su voluntad.</p>
输出:
<p class="mb-40px">moderniseringen av de omgivande flerfamiljshusen berodde helt på hans vilja.</p>
<p class="mb-40px">acţiunile de modernizare a blocurilor din jur depindeau în totalitate de voinţa lui.</p>
<p class="mb-40px">the modernization of the surrounding blocks of flats depended entirely on his will.</p>
<p class="mb-40px">la modernización de los bloques de pisos circundantes dependía enteramente de su voluntad.</p>
显然这很容易
寻找:^
替换为:<p class="mb-40px">
但在这种情况下,我将在第一行获得第一个标签的两倍:
<p class="mb-40px"><p class="mb-40px">
答案1
- Ctrl+H
- 找什么:
^(?!<p class="mb-40px">|\h*\R|\z)
- 用。。。来代替:
<p class="mb-40px">
- 查看 环绕
- 查看 正则表达式
- Replace all
解释:
^ # beginning of line
(?! # negative lookahead, make sure we haven't after:
<p class="mb-40px"> # literally
| # OR
\h* # 0 or more horizontal spaces
\R # any kind of linebreak
| # OR
\z # end of file
) # end lookahead
截图(之前):
截图(之后):
答案2
- Ctrl+H
- 找什么:
(?-s)^(?!<p class="mb-40px">)[\r\n]+
- 用。。。来代替:
<p class="mb-40px">
- 查看 相符
- 查看 环绕
- 查看 正则表达式
或者
- Ctrl+H
- 找什么:
(</p>)([\s\S]*?)^
- 用。。。来代替:
\1\n<p class="mb-40px">
- 查看 相符
- 查看 环绕
- 查看 正则表达式