Loading ...
Sorry, an error occurred while loading the content.

137283Substitution words within a partial match range help

Expand Messages
  • David Fishburn
    Apr 18, 2013
    • 0 Attachment
      Vim 7.3.758

      I have the following string:
      'match /\%(if\|elsif\|unless\|given\|when\|default\)\>/ match /\<\>/  nextgroup=perlElseIfError skip0 skip1 skip2'

      I was hoping (using 1 or 2 substitution commands) to find all words less than or equal to 5 characters in length and remove them.

      But, these words have to be within "match /.../" tags.

      So, when completed, the string above should read:
      'match /\%(\|\|unless\|\|\|default\)\>/ match /\<\>/  nextgroup=perlElseIfError skip0 skip1 skip2'

      Notice the skip0, skip1, skip2 are not touched since they are not within the beginning "match /" and the ending "/" of the match.

      My best try was the following:
      >echo substitute( 'match /\%(if\|elsif\|unless\|given\|when\|default\)\>/ match /\<\>/  nextgroup=perlElseIfError skip0 skip1 skip2', '\<match /.\{-}\zs\<\w\{1,5}\>\ze.\{-}/ ', '', 'g' )

      But it only gets rid of the "if" at the start, and doesn't work on any of the other matches.

      TIA,
      David

      --
      --
      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@....
      For more options, visit https://groups.google.com/groups/opt_out.
       
       
    • Show all 4 messages in this topic