in reply to Splitting on escapable delimiter
Well, here is my try (which does not work!). It is possible to use reverse and then lookahead assertions:
use strict; use warnings; # use re 'debug'; my $s = '#@##@###@####@#####@'; my @list = reverse split '@(?=(##)*[^#])', reverse $s; print scalar reverse $_, "\n" for @list;
I see the regexp only matches at the good @ signs, but I am getting a couple of ## in the output that I can't explain. I have tried with use re 'debug' and so I know the regexp is matching where I intended.
Output: #@## ## ###@#### ## #####@
Julio
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Splitting on escapable delimiter
by BrowserUk (Patriarch) on Mar 28, 2008 at 18:05 UTC | |
|
Re^2: Splitting on escapable delimiter
by Anonymous Monk on Mar 28, 2008 at 20:05 UTC |