in reply to Re: zero-length match increments pos() (saner)
in thread zero-length match increments pos()

I completely disagree. If a regex engine fails to find the zero width match at the end of a string then it is broken.

Note the correct way to refer to capture variables in the RHS is $1 etc, not \1.

Replies are listed 'Best First'.
Re^3: zero-length match increments pos() (saner)
by tye (Sage) on Feb 21, 2005 at 19:13 UTC

    It already found a match at the end of the string. It should not find two different matches at the end of the string.

    If I'd used $1 then I would have gotten

    x$1cx$1cx$1cx$1

    because it was vi, which isn't Perl (because otherwise it would have not been a good choice for demonstrating how it doesn't act like Perl).

    - tye