$escaped_str = <<'EOT'; Xa\X\\bXc\\XdX EOT chomp $escaped_str; my @array = (); my $escaped = 0; my $count = 0; for (split //, $escaped_str) { if (!$escaped && $_ eq 'X') { $count++; next; } $array[$count] .= $_; $escaped = ($_ eq "\\" && !$escaped) ? 1 : 0; } print "(",join(':',@array),")";
In reply to Re: split on unescaped delimiters
by delirium
in thread split on unescaped delimiters
by bsb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |