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

19726Re: Search and Replace and increment number at the same time

Expand Messages
  • Sheri
    Sep 30, 2009
      --- In ntb-clips@yahoogroups.com, "isola_60185" <isola_60185@...> wrote:
      > Might be way off base, I am not a seasoned NoteTab Pro user, nor
      > am I a progammer.
      > If I have strings in a txt file that look like this:
      > /y=250
      > /y=255
      > /y=260
      > Is there any way I can Search and Replace so that I can increment
      > each number (by 20 for example) so that the numbers look like:
      > /y=270
      > /y=275
      > /y=280
      > I have about 100 occurences of these numbers (they are for xy
      > coordinates) and I need to increment them. There are _no_ numbers
      > that repeat, all our unique.
      > I think I'm asking if NoteTab can recognize these strings as
      > numbers and then do a math operation on them but using a wildcard
      > as the search.
      > So search for /y=* and substitute the wildcard with the number+20.
      > Thanks.

      Yes, the clip code to do it follows.

      ^!Jump Doc_Start
      ^!Find "/y=\K\d+" RS
      ^!IfError Done
      ^!InsertText ^$Calc(^$GetSelection$ + 20)$
      ^!Goto RepLoop
      ^!Prompt All Done
      ;end of clip

    • Show all 9 messages in this topic