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

Bug in find?

Expand Messages
  • quux2000
    I was trying to edit a file, which I have posted here: http://pws.prserv.net/lms/defact.txt The first few lines are as follows:
    Message 1 of 4 , Feb 12 6:57 AM
    • 0 Attachment
      I was trying to edit a file, which I have posted here:

      http://pws.prserv.net/lms/defact.txt

      The first few lines are as follows:

      ######################################################################
      #
      # File :
      $Source: /cvsroot/ijbswa/current/default.action.master,v $
      #
      # $Id: default.action.master,v 1.1.2.37 2004/01/30 15:28:45 oes Exp $
      #
      # Purpose : Default actions file, see
      # http://www.privoxy.org/user-manual/actions-file.html
      #
      # Copyright : Written by and Copyright (C) 2001 - 2004 the
      # Privoxy team. http://www.privoxy.org/
      #

      The problem: When I open the file in NoteTab, cursor is positioned at
      the top of the document -- to the left of the first pound sign on the
      first line. Fine. I press control-F. NoteTab highlights the entire
      first line. I enter the word "file" as my search term and click Find
      Next, and NoteTab tells me, " "file" not found within selected
      text. " I intended to search the entire file, so this is not what I
      expected. If I open the file and move the cursor down to the second
      line by pressing the down arrow before doing this search, it *does*
      work. What's going on here?
    • Marcelo de Castro Bastos
      I ran into an odd problem. I was creating a clip to automate some reformatting I do in a file I receive regularly. One of the steps is to get rid of all the
      Message 2 of 4 , Nov 12, 2006
      • 0 Attachment
        I ran into an odd problem.

        I was creating a clip to automate some reformatting I do in a file I
        receive regularly. One of the steps is to get rid of all the empty lines.

        In the old Notetab 4.x, I could do that replacing \n\n+ with \n , and it
        worked fine.

        However, when I tried to do the same in Notetab Pro 5.1, I ran into all
        sorts of weird problems.

        First, I tried to adapt the syntax to the new regexp engine, like this:

        ^!Replace "\r\n[\r\n]+" >> "\r\n" TWRAS

        No dice. Although (when ran in interactive mode) it reports replacing a
        whole bunch of stuff, in practice the file is returned exactly the same
        as it was before.

        Then I tried some variations. I tried stuff like:

        ^!Replace "\r[\r\n]+" >> "\r\n" TWRAS

        or

        ^!Replace "\r\n[\r\n]+" >> "\r" TWRAS

        or even

        ^!Replace "\r[\r\n]+" >> "\n" TWRAS

        None of them did what it was wishing for. Some did nothing, others only
        achieved partial success.


        Then I tried going around the whole thing. I replaced the \r\n string
        with an unused character (the nordic "Thorn", if you are interested -- I
        have never seen it in any of the languages I can understand), and then
        replacing the chars, like this:

        ^!Replace "^p" >> "Þ" TWAS
        ^!Replace "ÞÞ+" >> "Þ" TWRAS
        ^!Replace "Þ" >> "^p" TWAS

        That works... but I REALLY, REALLY dislike it. It's an ugly hack. I know
        that NoteTab Pro is not supposed to have problems with very long lines
        anymore, but I think NoteTab Standard/Light still do? If so, there
        should be a better way to accomplish this.

        Marcelo
      • Sheri
        I think what you want is: ^!Replace ( r n){2,} $1 WRAS (replaces all occurrences in the whole file of 2 or more r n in a row to one r n) If you prefer
        Message 3 of 4 , Nov 12, 2006
        • 0 Attachment
          I think what you want is:

          ^!Replace "(\r\n){2,}" >> "$1" WRAS

          (replaces all occurrences in the whole file of 2 or more \r\n in a row
          to one \r\n)

          If you prefer you could use \r\n as the replacement text. The $1 just
          substitutes the \r\n from the parentheses.

          Regards,
          Sheri
        • Marcelo de Castro Bastos
          On the last exciting episode, aired on 12/11/2006 18:39, Sheri invited ... Thanks, worked as a charm. I can t believe that the whole concept of grouping
          Message 4 of 4 , Nov 12, 2006
          • 0 Attachment
            On the last exciting episode, aired on 12/11/2006 18:39, Sheri invited
            the wrath of the gods by saying:
            > I think what you want is:
            >
            > ^!Replace "(\r\n){2,}" >> "$1" WRAS
            >
            >
            Thanks, worked as a charm. I can't believe that the whole concept of
            grouping slipped my mind while I was working in this...

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