On Sun, Sep 6, 2009 at 00:24, Raphael Geissert<[email protected]> wrote:
> Hi Martín, Adam, *
>
> [Martín, hope you don't bother that I'm CC'ing you]
Not at all, I'm not subscribed to the bug.
> While checking something unrelated to the last patch I found that the
> following regex triggers an il:
>
> opts=uversionmangle=sx(.?)\Gxprint("foo")xg \
> http://sf.net/kcheckgmail/kcheckgmail-(.+)\.tar\.gz
Regarding this and what Adam's said before, from perlop man page:
Note also that, currently,
"\G" is only properly supported when anchored at the very
beginning of the pattern.
So, I don't think we need to support any of these two (broken)
examples as they rely on unspecified behaviour. The correct behaviour
for \G *does* work, as you can see in the following snippet:
> Other than that and #545234, I have not been able to break it, for now.$ perl
> -MPET::Watch -e '$r = shift; $s = shift; PET::Watch::safe_replace(\$s, $r) or
> die; print "$s\n"' 's/o|\Gb/#/g' foobarbaz
f###arbaz
The \G makes the first b replaced but not the second.
> What do you all think about the two patches?
> regarding my patch: fixing zero width matches should be easy, and that's the
> only known failure atm
> regarding Martín's-based patch: I'm not very keen on playing with pos(), and
> that was part of the reasons why I preferred to implement my fix the way I
> did it.
Well, I'm obviously biased, but I really prefer the pos() version as
it mimics exactly what the regex engine does.
--
Martín Ferrari
--
To unsubscribe, send mail to [email protected].