note
parv
<p>Is making the first part non-greedy not enough ...
<c>
my $list = "This is my list";
$list =~ m/^(.+?) # The 'rest' (Everything before last word)
(\w+) # Last 'word' (string of contiguous word characters)
\W*$ # Possible non-word characters at end of string
/x;
</c>
<p>... (would it fail on some other string)?
</p>
<p><i>Much later.</i> For English language, <c>\w</c> is not inclusive enough (lacks hyphen) and includes too much (includes underscore & digits). Short of a proper grammar based parser, I would rather use word regex which addresses that ...
<c>
$word_re = qr{ (?: & | -? [a-zA-Z]+ [a-zA-Z-]* ) }x;
</c>
<p> ... is still incomplete as it does not deal with accented characters; periods in a title; acronyms with spaces and/or periods, among other things.
</p>
11135816
11135834