May 8, 2014 at 10:57 pm #18384
Stefan
Participant
That is because we are trying to match
“Start-of-line, none-or-more whitespace, Linebreak”
“^\\s*\\n”
But the very last line didn’t have a linebreak at all.
Better is to match
“Linebreak, none-or-more whitespace, End-of-line”
“\\n\\s*$”
document.selection.Replace(“\\n\\s*$”,””,eeFindNext | eeReplaceSelOnly | eeReplaceAll | eeFindReplaceRegExp);
– – –
Or, for really empty lines only (don’t remove those with whitespace)
“Linebreak, End-of-line”
“\\n$”
document.selection.Replace(“\\n$”,””,eeFindNext | eeReplaceAll | eeReplaceSelOnly | eeFindReplaceRegExp);