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

regex question

Expand Messages
  • bold_cucumber
    Hi all, I just joined this group. I ve been using editplus for a number of years, it is my favorite code/text editor in windows. My question is this: Is it
    Message 1 of 3 , Aug 28, 2008
      Hi all, I just joined this group. I've been using editplus for a
      number of years, it is my favorite code/text editor in windows. My
      question is this:

      Is it possible to use the built-in regex capabilities to find lines
      that DO NOT match a given expression? I do a lot of digging through
      web logs, and frequently I'll want to remove all lines except ones
      that contain "POST", which tells me it was an HTTP post to the server
      rather than a GET. I haven't been able to figure out how to do it.

      Is there a way to perhaps loop through the entire document and try
      the regex on each line, and copy only the lines that match to another
      open file? Or what about writing a simple command line filter,
      similar to grep, to do this and call it as a user tool, and get the
      output somehow fed back into editplus? I bet I could use
      $(WindowList) to specify two open files, have my external program
      read the first one and write to the second one, causing editplus to
      complain that the file had changed and click yes to reload it, but
      that's a little clunky. Any ideas?

      Thanks!

      Josh
    • Mark Kahn
      Yes and no. There s no -direct- way to do it, but you can do replace all matching lines with something and whatever s left is what doesn t match. e.g. delete
      Message 2 of 3 , Aug 28, 2008
        Yes and no. There's no -direct- way to do it, but you can do replace all
        matching lines with something and whatever's left is what doesn't match.

        e.g. delete all matching lines then delete double-linebreaks, or replace
        them with "---&" which should make all matching lines start with --- and you
        can then find [^-].* which will give you all non-matching lines.

        -Mark

        On Thu, Aug 28, 2008 at 11:59 AM, bold_cucumber <bold_cucumber@...>wrote:

        > Hi all, I just joined this group. I've been using editplus for a
        > number of years, it is my favorite code/text editor in windows. My
        > question is this:
        >
        > Is it possible to use the built-in regex capabilities to find lines
        > that DO NOT match a given expression? I do a lot of digging through
        > web logs, and frequently I'll want to remove all lines except ones
        > that contain "POST", which tells me it was an HTTP post to the server
        > rather than a GET. I haven't been able to figure out how to do it.
        >
        > Is there a way to perhaps loop through the entire document and try
        > the regex on each line, and copy only the lines that match to another
        > open file? Or what about writing a simple command line filter,
        > similar to grep, to do this and call it as a user tool, and get the
        > output somehow fed back into editplus? I bet I could use
        > $(WindowList) to specify two open files, have my external program
        > read the first one and write to the second one, causing editplus to
        > complain that the file had changed and click yes to reload it, but
        > that's a little clunky. Any ideas?
        >
        > Thanks!
        >
        > Josh
        >
        >
        >


        [Non-text portions of this message have been removed]
      • bold_cucumber
        You sir, are a genius. I don t know why I didn t think of that. ... replace all ... match. ... replace ... and you ... lines ... through ... server ...
        Message 3 of 3 , Aug 29, 2008
          You sir, are a genius. I don't know why I didn't think of that.



          --- In editplus@yahoogroups.com, "Mark Kahn" <cwolves@...> wrote:
          >
          > Yes and no. There's no -direct- way to do it, but you can do
          replace all
          > matching lines with something and whatever's left is what doesn't
          match.
          >
          > e.g. delete all matching lines then delete double-linebreaks, or
          replace
          > them with "---&" which should make all matching lines start with ---
          and you
          > can then find [^-].* which will give you all non-matching lines.
          >
          > -Mark
          >
          > On Thu, Aug 28, 2008 at 11:59 AM, bold_cucumber
          <bold_cucumber@...>wrote:
          >
          > > Hi all, I just joined this group. I've been using editplus for a
          > > number of years, it is my favorite code/text editor in windows. My
          > > question is this:
          > >
          > > Is it possible to use the built-in regex capabilities to find
          lines
          > > that DO NOT match a given expression? I do a lot of digging
          through
          > > web logs, and frequently I'll want to remove all lines except ones
          > > that contain "POST", which tells me it was an HTTP post to the
          server
          > > rather than a GET. I haven't been able to figure out how to do it.
          > >
          > > Is there a way to perhaps loop through the entire document and try
          > > the regex on each line, and copy only the lines that match to
          another
          > > open file? Or what about writing a simple command line filter,
          > > similar to grep, to do this and call it as a user tool, and get
          the
          > > output somehow fed back into editplus? I bet I could use
          > > $(WindowList) to specify two open files, have my external program
          > > read the first one and write to the second one, causing editplus
          to
          > > complain that the file had changed and click yes to reload it, but
          > > that's a little clunky. Any ideas?
          > >
          > > Thanks!
          > >
          > > Josh
          > >
          > >
          > >
          >
          >
          > [Non-text portions of this message have been removed]
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.