I don't fully understand your requirements, but here's another possible approach to some kind of solution.
Notes:
>perl -wMstrict -le "my $letter = qq{One Mr. John Doe was a very good friend of John Jacob \n} . qq{Astor. They met often with William and Henry James and \n} . qq{Capt. Jean-Luc Picard at the quaint Tavern On The Green.}; print qq{''$letter''}; my $Capped = qr{ [[:upper:]] [[:lower:]]+ }xms; my $name = qr{ $Capped (?: - $Capped)* }xms; my $full_name = qr{ $name (?: \s+ $name)+ }xms; my @names = map { tr{ \t\n}{ }s; $_ } $letter =~ m{ $full_name }xmsg ; print qq{'$_'} for @names; " ''One Mr. John Doe was a very good friend of John Jacob Astor. They met often with William and Henry James and Capt. Jean-Luc Picard at the quaint Tavern On The Green.'' 'One Mr' 'John Doe' 'John Jacob Astor' 'Henry James' 'Jean-Luc Picard' 'Tavern On The Green'
In reply to Re: Finding a capitalised pair of words in a text
by AnomalousMonk
in thread Finding a capitalised pair of words in a text
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |