lima1 wants minimal matches, so the
{49,} should actually be
{49,}?, in which case it stops working.
The reason is that the look-ahead is not limited to what the [\w\s]{49,}? matches. A small demonstration:
#!/usr/bin/perl
use strict;
use warnings;
my $re = qr{^\s*(?=\w+\s+\w+)[\w\s]{49,}?\w};
my $str = ('x' x 65) . ' x';
if ($str =~ m/$re/) {
print $&, $/;
}
__END__
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You see that match only includes a long word, not a sentence. There is a sentence present, but it's not matched.
Update: In Perl 6 you could use & like this:
regex short_word {
\s*
[
& \w+ \s+ \w+
& .**?{1..50}
]
}