我想在分隔符前面进行拆分,但是如果没有特殊字符,则不会进行拆分。
my $str = "a,b,c,d,e";
my @lst = split (/,/, $str);
# gives me: ("a", "b", "c", "d", "e")
# now I want to split after any , with not a character c in front of the ,.
# ("a", "b", "c,d", "e")
我尝试了
split (/(?!c),/, $str)
但它并未如预期般运行。