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

4418Re: [edit+] Re: Can a RegExp replace handle incrementing a number?

Expand Messages
  • Mark Kahn
    Jan 10, 2006
      no problem. I've been meaning to write a regex tool for a while now anyway.

      If you want to drop the first two lines, change:

      var RX = eval(lines[0]);
      var RP = lines[1].replace(/\r\n/, '');
      text = lines.splice(2, lines.length).join('\n');

      set RX to whatever the regular expression is, set RP to the replacement
      statement, and comment out that text = ... line.

      -Mark

      On 1/10/06, kraemz <jkraemer@...> wrote:
      >
      > Oh wow... thanks *so* much Mark! I never expected you to do all the
      > work for me. This is a great kindness, and I really appreciate your
      > effort. It works like a charm! (I'm not sure how I managed to make
      > you like me, but hey, I won't complain! You've proven pretty likeable
      > yourself ;)
      >
      > I haven't had a lot of time to play with it yet, since I'm on my way
      > out the door, but I'll experiment more tomorrow. One of the things
      > I'll be looking into is whether I can modify the code to pass the
      > first two required lines as arguments for the text filter, since,
      > while I understand the great versatility of what you've written, for
      > my purposes the search and replace parameters will rarely change (I
      > can see the need to decrement on occasion, but that's dead simple
      > with what you've provided). I'm also curious to see whether I can run
      > the filter from the cursor location rather than over the entire file
      > (I actually just tried this, and it seems to work, as long as I
      > select the desired lines, and as long as the first two selected lines
      > are the search and replace expressions). I'll check all this out in
      > more depth tomorrow, and will report my findings.
      >
      > Thanks very much once again, Mark!
      > J
      >
      >
      >
      >
      >
      >
      > http://www.editplus.com
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
      >
      >
      >


      [Non-text portions of this message have been removed]
    • Show all 8 messages in this topic