in reply to Re^2: Easy Split
in thread Easy Split

split /[^\\](?:\\\\)*\K:/, $string worked Ok for me: it splits on an even number of inverted bars, followed by a colon, but keeps the bars in the split strings.
sub x($) { local($_) = @_; say "\n$_ ==>"; say for split /[^\\](?:\\\\)*\K:/, $_ } x $_ for <DATA>; __DATA__ 111111111:22222\:2222:333333333:4444444 111111111:22222\\:2222:333333333:4444444 111111111:22222\\\:2222:333333333:4444444 111111111:22222\\\\:2222:333333333:4444444
Result:
111111111:22222\:2222:333333333:4444444 ==> 111111111 22222\:2222 333333333 4444444 111111111:22222\\:2222:333333333:4444444 ==> 111111111 22222\\ 2222 333333333 4444444 111111111:22222\\\:2222:333333333:4444444 ==> 111111111 22222\\\:2222 333333333 4444444 111111111:22222\\\\:2222:333333333:4444444 ==> 111111111 22222\\\\ 2222 333333333 4444444
Beware that '222\\:222' only has ONE inverted bar... :-D
[]s, HTH, Massa (κς,πμ,πλ)