- Ctrl + H
- Найти что:
((?:.+\R)+)(\R)(?:((?:.+\R)+)(\R))?
- Заменить на:
$1[BLANK A]$2(?3$3[BLANK B]$4)
- CHECK Обтекание
- CHECK Регулярное выражение
- UNCHECK
. matches newline
- Заменить все
Объяснение:
( # group 1 (will contain consecutive non blank lines)
(?: # non capture group
.+ # 1 or more any character but newline
\R # any kind of linebreak (i.e. \r, \n, \r\n)
)+ # end group, may appear 1 or more times
) # end group 1
(\R) # group 2, any kind of linebreak (i.e. first blank line)
(?: # non capture group
( # group 3, same pattern as in group 1
(?:
.+
\R
)+
)
(\R) # group 4, any kind of linebreak (i.e. second blank line)
)? # end group, optional
Замена:
$1 # content of group 1 (non blank lines)
[BLANK A] # replacement for first blank line
$2 # content of group 2, (a linebreak)
(?3 # if group 3 exists:
$3 # content of group 3 (non blank lines)
[BLANK B] # replacement for second blank line
$4 # content of group 4, (a linebreak)
) # end condition
Снимок экрана (до):
Снимок экрана (после ):