Tim Brosnan wrote:

> I initially send a version of this message through the google groups 
> interface, but it seems to have disappeared. Apologies if there is 
> duplication.
> 
> When going through some regex examples from 
> VimRegexTutor(https://github.com/dahu/VimRegexTutor) I found that one of 
> the examples did not match the provided text when run in 7.4.383. Here 
> is the regex and the sample text:
> 
>   *30* : Find Text between HTML tags >
> 
>       /\%(<\1>\)\@<=.*\%(<\/\(\w\+\)>\)\@=
> 
>       OR
> 
>       /\v%(\<\1\>)@<=.*%(\<\/(\w+)\>)@=
> <
>       <level>Can I play, daddy?</level>
> 
> Neither of the provided regexs would watch the sample text (it should 
> match the text between html tags). However, when I tried 7.1.42 (only 
> other version at hand) I found that the text between tags was matched 
> correctly. Both versions were fun as -u NONE and "set nocompatible" to 
> try to rule out option or plugin clashes.
> 
> Is this is a bug or has regex behaviour changed between 7.1.42 and 7.4.383?

I don't think the pattern is supposed to work.  The backreference is
before the capturing group.  It's a suprise it works at all.  Probably
because in the old regex engine the "\@<=" part is used only after
finding a match for the rest.

It's a very inefficient pattern too, better use:

       /<\(\w\+\).\{-}>\zs.*\ze<\/\1>


-- 
I once paid $12 to peer at the box that held King Tutankhamen's little
bandage-covered midget corpse at the De Young Museum in San Francisco.  I
remember thinking how pleased he'd be about the way things turned out in his
afterlife.
                                (Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui