3
如果沒有特殊字符,我想在分隔符前分割。帶分隔符前綴的Perl拆分正則表達式
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)
但預計它不工作。