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

Re: math in a substitue clause?

Expand Messages
  • Tim Chase
    ... Both you and Colin gave this answer and it works like a charm. Thanks. I remembered seeing something about using the = but when I do a ... I get sent to
    Message 1 of 4 , Oct 30, 2002
    • 0 Attachment
      > :help sub-replace-special
      > Haven't tried it, but you probably want something like
      >
      > :'<,'>s/y="\(\d*\)"/\="y=".(0+submatch(1))+4/

      Both you and Colin gave this answer and it works like a charm. Thanks. I
      remembered seeing something about using the \= but when I do a

      :he \=

      I get sent to the help where \= means "0 or 1 of the previous atom" in a
      search pattern. The "sub-replace-special" was the ticket, but I needed
      the nudge to the right keyword by those of you in the know. ;-) I'm still
      a bit fuzzy on how and when exactly to use the \= in this context. If I
      read the docs correctly, it's only when it's the first thing in the line,
      which is prob. what's been my gotcha in the past. With the right
      keywords, it's all there...now that I've got a hook into the docs, ":he
      submatch" shows an example doing a variant of what I wanted.

      Thanks!

      -tim
    Your message has been successfully submitted and would be delivered to recipients shortly.