And
print if m{ (whatever) (?: \s+ \1){$n} \s* \Z }xms;
generalizes to any n.
>perl -wMstrict -le "my @lines = ( 'foo A A A', 'foo bar A B A', 'foo bar baz A A A' ); my $n = 3; $n -= 1; for my $line (@lines) { print qq{'$line'} if $line =~ m{ \b ([[:alpha:]]) (?: \s+ \1){$n} \s* \Z }xms; } " 'foo A A A' 'foo bar baz A A A'
In reply to Re^3: ignore some delimiters while using split
by AnomalousMonk
in thread ignore some delimiters while using split
by nurulnad
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |