in reply to Re^3: regex doubt on excluding
in thread regex doubt on excluding
Well, the ^ could match the newline after "def", and the $ could match the newline before 'gh'. and all the newlines between those two are greedily accepted by the \s+ and thus eliminated.
^ matching *after* a newline means the first newline would not be included and eliminated. $ matching before a newline means the last newline is not eliminated either.
Those two newlines make for one blank line between the non-blank lines, and any excess whitespace including newlines between them is removed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: regex doubt on excluding
by Athanasius (Archbishop) on Apr 22, 2014 at 09:33 UTC | |
by Anonymous Monk on Apr 22, 2014 at 10:58 UTC | |
by Athanasius (Archbishop) on Aug 16, 2014 at 06:25 UTC | |
|
Re^5: regex doubt on excluding
by Lotus1 (Vicar) on Apr 21, 2014 at 17:44 UTC |