Sunday, December 22, 2013

Re: Possible bug(s) in new regex engine involving \@> and \?

On Sunday, December 22, 2013 3:05:06 PM UTC-6, coot_. wrote:
> On 20:53 Sun 22 Dec , Marcin Szamotulski wrote:
>
> > On 05:52 Sat 21 Dec , Brett Stahlman wrote:
>
> > > Possible bugs in new regex engine involving \@> and \?
>
> > >
>
> > > Using the following line of text...
>
> > > 0123456789
>
> > >
>
> > > ...run the following two :substitute commands with both old and new regex engine, and notice the differences...
>
> > >
>
> > > s/\(01\)\(23\)\@>\(.*\)/--\1--\2--\3/
>
> > > Old (\%=1)
>
> > > --01--23--456789
>
> > > New (\%=2)
>
> > > ----23--456789
>
> > >
>
> > > s/\(01\)\(23\d\@=\)\?\(.*\)/--\1--\2--\3/
>
> > > Old (\%=1)
>
> > > --01--23--456789
>
> > > New (\%=2)
>
> > > --01----23456789
>
> > >
>
> > > Note: The \d\@= in the second example could be replaced with other matching zero-width assertions (e.g., \%v) without changing the results.
>
> > >
>
> > > Brett S.
>
> >
>
> > Hi,
>
> >
>
> > Which version of vim are you using. I cannot reproduce here (Vim
>
> > 7.4.126, GNU/Linux) the first one, but I can reproduce the second one.
>
> >
>
> > Best regards,
>
> > Marcin
>
>
>
>
>
> It seems that there is a problem with grouping, since event these
>
> patterns fail with 'set re=2':

Yes. But without the \?, re=2 behaves as expected.
Brett S.

>
> :s/\(01\)\(23\%(\d\@=\)\)\?\(.*\)/--\1--\2--\3
>
> :s/\(01\)\(23\%(\d\)\@=\)\?\(.*\)/--\1--\2--\3
>
>
>
>
>
> Best,
>
> Marcin

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: