Hello, @gabor-szakacs, @scott-sumner, and All,
Indeed, Scott, I thought about capturing \R ! But, as my regex have two alternatives, when it matches \h+\R, the group 2 ( = \R ), in the first alternative does not exist. Thus, I need to capture \R in the second alternative, too ( group 3 )
So :
SEARCH (\h*(\R)){3,}|\h+(\R)
REPLACE (?1\2\2:\3)
And, of course, the conditional replacement rewrites :
Two line-breaks \2\2, if the first alternative is found
One line-break \3, if the second alternative is found
However, to my mind, this second syntax does not look as elegant as my previous one ;-))
Cheers,
guy038
BTW, my previous regex S/R may be slightly shortened as :
SEARCH (\h*\R){3,}|\h+\R
REPLACE \r\n?1\r\n ( or \n?1\n on UNIX files )