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. Not everybody who uses git can upgrade their Perl to newer versions. We try to stick to "5.6.1 or later"; anything that is not available in 5.8 series is too new to be used outside the contrib/ area. That's the point Francis raised that you missed. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html