On 22:15 Wed 24 Oct , Dan Thurman wrote: > > I have an XML document and wanted to remove > the following strings: > > <text:alphabetical-index-mark text:string-value="String" text:key1="S"/> > > There are hundreds of places where the alphabetical-indexes > are interspersed and "String", "key1" and "S" are variable, so > what vi command string can I use to delete these text? > > I have tried many combinations, the simplest being: > > :1,$ s~<text:alphabetical-index-mark .*/>~~g > > but the problem is with ".*", of which the search > pattern takes out everything to very the last "/>" > pattern found which is not what I want. > > > -- > 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
Hi Dan, You can substitute the greedy match .* with something less 'hungry' ;) :%s~<text:alphabetical-index-mark [^>]*/>~~g This will work if none of the strings contain a '>'. 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
