
8 Sep
2009
8 Sep
'09
10:58 p.m.
On Tue, Sep 8, 2009 at 6:07 PM, Marcello Perathoner<marcello@perathoner.de> wrote:
But no way to decide which ones to drop and which one to keep.
Given the previous example, negative lookahead assertions seem to fit well here: s/(?<!\n)\n(?!\n)/.../g or perhaps ^\n(?!\n) if you need to anchor it or /\n(?!\n)/ for zero width and /\n[^\n]/ for width=1 and so on. Plenty of ways to skin that cat in most regex-capable languages.