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

Re: subsitute certain repeated pattern in a line

Expand Messages
  • Gerald Lai
    ... This follows the regex search pattern of searching the th occurrence of : /^ %(. {-} zs ) { } Hope this helps. -- Gerald
    Message 1 of 4 , Mar 30, 2006
      On Thu, 30 Mar 2006, Edward Wong wrote:

      > Dear Tim,
      >>> My brain is stuck and I feel that I'm loosing my energy
      >>> like a balloon...Now I'm thinking neither any vim pattern
      >>> nor regexp but a hot lovely Starbuck coffee. ;-)
      >> Haven't had my coffee, but then again, I'm not much of a
      >> coffee drinker. However, I'm fueling my little grey cells
      >> with bagel pizzas for dinner.
      > Bagel and pizzas sound a lot more healthier than coffee to me. :)
      >> %s/DB__\(\%(.\{-}DB__\)\{,4}\)/\="DB__".substitute(submatch(1),"DB__","","g")/g
      > It works great Tim! I have never used submatch before. Definitely it's
      > going to be helpful in a lot of cases. Thank you very much again.

      Here's another way:


      This follows the regex search pattern of searching the <n>th occurrence
      of <search>:


      Hope this helps.
    Your message has been successfully submitted and would be delivered to recipients shortly.