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

75927Re: Matching JUST the nth occurence of a text in a line

Expand Messages
  • Charles E Campbell Jr
    Dec 1, 2006
      mzyzik@... wrote:

      >I am puzzled by a slightly more complicated version:
      > how to match a '%' character following the 2nd occurrence of "home"?
      >
      >
      /^.\{-}\%(home.\{-1,}\)\{N}home.\{-}\zs%

      where N is 1 for the "2nd occurrence" (N is 2 for the third occurrence,
      etc).

      This pattern matches up to and including the 2nd home, extends past a
      minimal amount of anything up to but not including a %, whereupon the
      pattern matching starts.

      Regards,
      Chip Campbell
    • Show all 20 messages in this topic