darlingm / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

Regex matching behaviour has changed in 7.4 #243

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open 7.4
2. View some html, ie : <b>test test</b>
3. Search using the following regex:
    /\v%(\<\1\>)@<=.*%(\<\/(\w+)\>)@=

What is the expected output? What do you see instead?
In previous version (I have only confirmed for 7.1.42) the regex will correctly 
match the text between the html tags, following the behaviour in the regex 
documentation. In 7.4 it fails to match.

What version of the product are you using? On what operating system?

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 10 2013 14:38:33)
MS-Windows 32-bit GUI version with OLE support
Compiled by mool@tororo
Big version with GUI.  Features included (+) or not (-):
+arabic             +cmdline_hist       +digraphs           +float              
+libcall            +mouseshape         +printer            +smartindent        
-tgetent            +viminfo
+autocmd            +cmdline_info       -dnd                +folding            
+linebreak          +multi_byte_ime/dyn -profile            -sniff              
-termresponse       +vreplace
+balloon_eval       +comments           -ebcdic             -footer             
+lispindent         +multi_lang         +python/dyn         +startuptime        
+textobjects        +wildignore
+browse             +conceal            +emacs_tags         +gettext/dyn        
+listcmds           -mzscheme           +python3/dyn        +statusline         
+title              +wildmenu
++builtin_terms     +cryptv             +eval               -hangul_input       
+localmap           +netbeans_intg      +quickfix           -sun_workshop       
+toolbar            +windows
+byte_offset        +cscope             +ex_extra           +iconv/dyn          
-lua                +ole                +reltime            +syntax             
+user_commands      +writebackup
+cindent            +cursorbind         +extra_search       +insert_expand      
+menu               +path_extra         +rightleft          +tag_binary         
+vertsplit          -xfontset
+clientserver       +cursorshape        +farsi              +jumplist           
+mksession          +perl/dyn           +ruby/dyn           +tag_old_static     
+virtualedit        -xim
+clipboard          +dialog_con_gui     +file_in_path       +keymap             
+modify_fname       +persistent_undo    +scrollbind         -tag_any_white      
+visual             -xterm_save
+cmdline_compl      +diff               +find_in_path       +langmap            
+mouse              -postscript         +signs              +tcl/dyn            
+visualextra        +xpm_w32
   system vimrc file: "$VIM\vimrc"
     user vimrc file: "$HOME\_vimrc"
 2nd user vimrc file: "$HOME\vimfiles\vimrc"
 3rd user vimrc file: "$VIM\_vimrc"
      user exrc file: "$HOME\_exrc"
  2nd user exrc file: "$VIM\_exrc"
  system gvimrc file: "$VIM\gvimrc"
    user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$HOME\vimfiles\gvimrc"
3rd user gvimrc file: "$VIM\_gvimrc"
    system menu file: "$VIMRUNTIME\menu.vim"
Compilation: cl -c /W3 /nologo  -I. -Iproto -DHAVE_PATHDEF -DWIN32   
-DFEAT_CSCOPE -DFEAT_NETBEANS_INTG   -DFEAT_XPM_W32   -DWINVER=0x0400 
-D_WIN32_WINNT=0x0400  /Fo.\ObjGOLYHTRi386/ /Ox /GL -DNDEBUG  /Zl /MT 
-DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_W32 -DDYNAMIC_ICONV 
-DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl85.dll\" 
-DDYNAMIC_TCL_VER=\"8.5\" -DFEAT_PYTHON -DDYNAMIC_PYTHON 
-DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 
-DDYNAMIC_PYTHON3_DLL=\"python32.dll\" -DFEAT_PERL -DDYNAMIC_PERL 
-DDYNAMIC_PERL_DLL=\"perl514.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY 
-DDYNAMIC_RUBY_VER=19 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby192.dll\" -DFEAT_BIG 
/Fd.\ObjGOLYHTRi386/ /Zi
Linking: link /RELEASE /nologo /subsystem:windows /LTCG:STATUS oldnames.lib 
kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib 
uuid.lib /machine:i386 /nodefaultlib gdi32.lib version.lib   winspool.lib 
comctl32.lib advapi32.lib shell32.lib  /machine:i386 /nodefaultlib libcmt.lib 
oleaut32.lib  user32.lib      /nodefaultlib:python27.lib 
/nodefaultlib:python32.lib   "E:\tcl\lib\tclstub85.lib" WSock32.lib 
xpm\x86\lib\libXpm.lib /PDB:gvim.pdb -debug

Please provide any additional information below.
I have repeated this with -u NONE and set nocompatible to rule out any issues 
with plugins or options.

Original issue reported on code.google.com by timothy....@ucdconnect.ie on 29 Jul 2014 at 7:19

GoogleCodeExporter commented 9 years ago
You are using a backreference before the () group that defines it contents, 
that doesn't work.  I'm surprised this works in the backtracking engine, that 
might be called a bug.

Original comment by brammool...@gmail.com on 30 Jul 2014 at 9:42

GoogleCodeExporter commented 9 years ago
Thanks. In future, should regexs be re-ordered such that backreferences always 
come after capture groups?

Original comment by timothy....@ucdconnect.ie on 30 Jul 2014 at 9:48

GoogleCodeExporter commented 9 years ago
I based that regex on the information in   :help /\@<=   and the example:

\1\@<=,\([a-z]\+\)  ",abc" in "abc,abc"

When it worked, I accepted it and moved on. :-)

Original comment by barry.ar...@gmail.com on 30 Jul 2014 at 10:01

GoogleCodeExporter commented 9 years ago
Thanks for the pointer to the help.  I will add a note there that this only 
works with the old regexp engine, and show how to do it with \zs instead.

Original comment by brammool...@gmail.com on 30 Jul 2014 at 11:04

GoogleCodeExporter commented 9 years ago
Thanks for the \zs\ze version. I have added that to VimRegexTutor.

Original comment by barry.ar...@gmail.com on 30 Jul 2014 at 11:15