Something like this?
use strict; use warnings; my $text = 'The cat jumped over the dog. Smart cat! He jumped over the + dog. The cat jumped over the dog. Smart cat!'; my %seen; my $longest = ''; while ($text =~ /\s*(.+?[!?.])/g) { $longest = $1 if $seen{$1}++ && length $1 > length $longest; } print $longest,$/;
Prints:
The cat jumped over the dog.
But it's a whole other challenge if you mean "phrase" and not (terminated) sentence.
In reply to Re: Finding duplicate text in a paragraph
by hbm
in thread Finding duplicate text in a paragraph
by Jester
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |