Re: Q: // and "magic"



Joe Smith <joe@xxxxxxxxx> wrote:
> xhoster@xxxxxxxxx wrote:
>
> >> If the PATTERN evaluates to the empty string, the last
> >> *successfully* matched regular expression is used instead. In
> >> this case, only the "g" and "c" flags on the empty pattern is
> >> honoured - the other flags are taken from the original pattern.
> >> If no match has previously succeeded, this will (silently) act
> >> instead as a genuine empty pattern (which will always match).
> >
> > So, does anyone find this behavior useful? I've never intentionally
> > used it, and I can't imagine doing so in the future.
>
> That's the way vi works. (And jove but not emacs.)

My version of vi doesn't work that way. It uses the most recently
specified search, not the most recently successful search. (But I just use
'n' when I want to repeat a search, so I could ask the same question
on this vi feature as I did on the Perl one.)

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.



Relevant Pages

  • Re: Bug in Strings split method???
    ... >>> applied and therefore affects the length of the resulting array. ... >>> the limit n is greater than zero then the pattern will be applied at ... >>> The limit was zero so the empty trailing field should have been ... There is no trailing empty string until ...
    (comp.lang.java.programmer)
  • Re: What does this do ? !/somestring/
    ... transliteration)] it is interpreted as a search pattern at run time." ... contains a variable that is set to the empty string. ... because the m/Wor/ match was the last successful pattern match. ...
    (comp.lang.perl.misc)
  • Re: Q: // and "magic"
    ... In the context of the split function, // matches the empty string. ... // means the last successful pattern match. ... Sinan Unur ...
    (comp.lang.perl.misc)
  • Re: regexp lookahead
    ... Jussi> The look-ahead pattern and the following pattern match at ... matches the empty string between ... when one of the expected groups, inside a bracket pair, was empty. ...
    (comp.lang.java.programmer)
  • Re: Q: // and "magic"
    ... >> If the PATTERN evaluates to the empty string, ... >> honoured - the other flags are taken from the original pattern. ... alternation in regular expressions in favor of or tests in the ... Sinan Unur ...
    (comp.lang.perl.misc)

Loading