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

Re: Search & Replace --help needed

Expand Messages
  • Bill McCarthy
    ... This is nice. Replacing W with _W will get it beyond line boundaries. -- Best regards, Bill --~--~---------~--~----~------------~-------~--~----~
    Message 1 of 4 , May 31, 2008
    • 0 Attachment
      On Sat 31-May-08 8:35am -0600, Tim Chase wrote:

      >> Qn1 : I want to replace a search pattern, only if the pattern is 3rd
      >> ('n'th) word in that sentence. How to do this?

      > The boundary definition for "a sentence" is a little
      > underdefined, so taking a whack at it:
      >
      > %s/\%(^[A-Z]\@=\|[].)!?] \)\<\%(\w\+\W\+\)\{2\}\zs\w\+/XX&XX/g

      This is nice. Replacing '\W' with '\_W' will get it beyond
      line boundaries.

      --
      Best regards,
      Bill


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.