【发布时间】:2021-11-17 12:55:26
【问题描述】:
我正在使用(?<=(?:(?:\w|,|'){1,20} ){2}(?:\w|,|'){1,20} ?)\.
但它没有按预期工作:
use v5.35.2;
use warnings;
use strict;
my $str = shift // q{If you have to go. you go. That's no problem.};
my $regex = qr/(?<=(?:(?:\w|,|'){1,20} ){2}(?:\w|,|'){1,20} ?)\./;
my @all_parts = split $regex, $str;
say for@all_parts;
它应该打印出If you have to go 和 you go. That's no problem
有没有更简单的方法来实现这一点?
【问题讨论】: