in reply to Splitting on escapable delimiter
Intuatively, you want to use split '(?<=(?:##)+)\@', $s;; but that gets you:
[Variable length lookbehind not implemented in regex; ...
So how to achieve a variable length lookbehind? Here's one way:
print $s;; #@##@###@####@#####@ print for split '(?:(?<=[^#]####)|(?<=[^#]##)|(?<!#))[@]', $s;; #@## ###@#### #####@
Of course the downside is that you need to include a case for each length of lookbehind which quickly gets unweildy:
print for split '(?:(?<=[^#]########)|(?<=[^#]######)|(?<=[^#]####)|(? +<=[^#]##)|(?<!#))[@]', $s;;
|
|---|