On Mon, 10 Nov 2008, Junio C Hamano wrote: > Ian Hilt <ian.hilt@xxxxxxx> writes: > > > On Sun, 9 Nov 2008, Junio C Hamano wrote: > >> Ian Hilt <ian.hilt@xxxxxxx> writes: > >> > >> > On Sun, 9 Nov 2008, Francis Galiegue wrote: > >> >> Le Sunday 09 November 2008 13:59:48 Ian Hilt, vous avez écrit : > >> >> > + if ($c_file =~ /^To:\s*+(.+)\s*\nCc:/ism) { > >> >> > >> >> Greedy operators are only supported with perl 5.10 or more... I think it's a > >> >> bad idea to use them... > >> ... > >> You expect something non-blank there anyway, so why not do: > >> > >> To:\s*(\S.*?)\s*\n.... > > > > That works. Although, I seem to be missing Francis' point. According > > to perlre, a quantified subpattern is "greedy". So a "greedy operator" > > is any one of the standard quantified subpatterns. The "+" and "?" > > modify its matching behavior. And it seems to me that it _has_ to use a > > q.s. to work ... > > The "perlre" documentation you are reading is from Perl 5.10.0; check > "perldelta" documentation next to it. > > I think you are wrong in saying that "it _has_ to use". Yes, you _can_ > use possessive quantifiers to write that pattern (provided if you can > limit your users to Perl 5.10.0 or later), but you do _not_ have to (and I > just showed you how). By not using the new feature, you can make it work > for people with older version of Perl. Right. I was saying it has to use quantifiers, in general, not that it has to use possessive quantifiers.