in reply to How do I match this without lookbehind?
my @results = grep {$_} split /([~]*?[^~])/, $input; [download]