我需要在一些用 . 分隔的句子中间添加一个字符串\n
。例如:
INPUT OUTPUT
V2+count -> V2+came+count
V6+num -> V6+came+num
V10+hi+town -> V10+came+hi+town
和
N2+hello -> N2+went+hello
N7+time -> N7+went+time
到目前为止我写的代码是
if ($new=~/\(came\)\|\(went\)/) {
my $prev_tag = $`;
if ($prev_tag5=~ /\(V\d+?\)?\+$/) {
$new=~ s/\(came\)\|//;
} else {
$new=~s/\(went\)\|//;
}
}