is it possible to replace every 4 Lines the Break to a Tab in UE or NPP with a regex search/replace?
File before:
#12
ab
cde
ef
#34
ghij
ijk
kl
#5678
uv
w
xyz
...
should be after replace
#12 ^t ab ^t cde ^t ef
#34 ^t ghij ^t ijk ^t kl
#5678 ^t uv ^t w ^t xyz
Here is a way to do the job:
Find what: (.+)\R(.+)\R(.+)\R(.+\R)?
Replace with: $1\t$2\t$3\t$4
Check Regular Expression
DON'T check dot matches newline
and click Replace All
.
Explanation:
(.+)\R : Capture in group 1 everything until a line break (excluded)
(.+)\R : Capture in group 2 everything until a line break (excluded)
(.+)\R : Capture in group 3 everything until a line break (excluded)
(.+\R)? : Capture in group 4 everything until a line break (included), optional
\R
stands for any kind of linebreak (ie. \r
or \n
or \r\n
)