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

Search and replace query.

Expand Messages
  • John Fitzsimons
    Hi, I want to find all lines in a document that contain a . I want to find all lines in a document that don t contain a . How do I do this using the find or
    Message 1 of 7 , Feb 3, 2008
    • 0 Attachment
      Hi,

      I want to find all lines in a document that contain "a".

      I want to find all lines in a document that don't contain "a".

      How do I do this using the find or search and replace options ? I
      have tried things such as ^.@(a).@$\n and it doesn't work. :-(

      Using NoteTab Pro 4.95


      Regards, John.
    • buralex@gmail.com
      John Fitzsimons said on Feb 03, 2008 19:11 ... not sure what you thought the ampersands (@) would do, but circumflex before a character
      Message 2 of 7 , Feb 3, 2008
      • 0 Attachment
        John Fitzsimons <johnf@...> said on Feb 03, 2008 19:11
        -0500 (in part):
        > I want to find all lines in a document that contain "a".
        >
        > I want to find all lines in a document that don't contain "a".
        >
        > How do I do this using the find or search and replace options ? I
        > have tried things such as ^.@(a).@$\n and it doesn't work. :-(
        >
        > Using NoteTab Pro 4.95

        not sure what you thought the ampersands (@) would do, but circumflex
        before a character in a character class says:
        any character except it ie. [^a] matches NOT "a"
        so ^[^a]+$ matches ... beginning at char 1 a string of NOT a's through
        the end of line ($)

        Regards ... Alec -- buralex-gmail
        --



        [Non-text portions of this message have been removed]
      • John Fitzsimons
        ... Hi Alex, ... Actually the letter was i but it was the general syntax I was wanting. ... Wow ! Excellent. Thanks for the very speedy/accurate reply, it is
        Message 3 of 7 , Feb 3, 2008
        • 0 Attachment
          On Sun, 03 Feb 2008 19:52:49 -0500, buralex@... wrote:

          > John Fitzsimons <johnf@...> said on Feb 03, 2008 19:11
          >-0500 (in part):

          Hi Alex,

          >> I want to find all lines in a document that contain "a".

          >> I want to find all lines in a document that don't contain "a".

          Actually the letter was "i" but it was the general syntax I was
          wanting.

          >> How do I do this using the find or search and replace options ? I
          >> have tried things such as ^.@(a).@$\n and it doesn't work. :-(

          >> Using NoteTab Pro 4.95

          >not sure what you thought the ampersands (@) would do, but circumflex
          >before a character in a character class says:
          >any character except it ie. [^a] matches NOT "a"
          >so ^[^a]+$ matches ... beginning at char 1 a string of NOT a's through
          >the end of line ($)

          Wow ! Excellent. Thanks for the very speedy/accurate reply, it is very
          much appreciated. :-) :-) :-)


          Here is what I started with ;

          paxton
          pinite
          taipei
          tiepin
          atone
          axone
          epona
          inapt
          inept
          ionia
          oaten
          panto
          patio
          paton

          Using your ^[^i]+$ replaced with nothing got me......

          pinite
          taipei
          tiepin



          inapt
          inept
          ionia


          patio

          Is there any way I can adapt that to get....

          pinite
          taipei
          tiepin
          inapt
          inept
          ionia

          In other words, find the words without "i", replace them with nothing,
          and delete the empty line ? Leaving behind the list of words/lines
          containing "i" without spaces ?


          Regards, John.
        • buralex@gmail.com
          John Fitzsimons said on Feb 03, 2008 20:30 ... Off-hand I can t think of how to do it in NTB4.95 as a one-liner (nor for that matter in
          Message 4 of 7 , Feb 3, 2008
          • 0 Attachment
            John Fitzsimons <johnf@...> said on Feb 03, 2008 20:30
            -0500 (in part):
            > In other words, find the words without "i", replace them with nothing,
            > and delete the empty line ? Leaving behind the list of words/lines
            > containing "i" without spaces ?
            Off-hand I can't think of how to do it in NTB4.95 as a one-liner (nor
            for that matter in NTB5) but you can clear all the empty lines by
            replacing "\n\n+" by "\n".

            In a clip it would be this two-liner:
            ^!replace "^[^i]+$ >> "" rwais
            ^!replace "\n\n+" >> "\n" rwais

            Note: any more discussion should go to the clips list :-) and do
            consider getting NTB5 if only for the improved regular expression syntax.

            http://tech.groups.yahoo.com/group/ntb-clips/
            > On Sun, 03 Feb 2008 19:52:49 -0500, buralex@... wrote:
            >
            >
            >> > John Fitzsimons <johnf@...> said on Feb 03, 2008 19:11
            >> >-0500 (in part):
            >>
            >
            > Hi Alex,
            >
            >
            >>> >> I want to find all lines in a document that contain "a".
            >>>
            >
            >
            >>> >> I want to find all lines in a document that don't contain "a".
            >>>
            >
            > Actually the letter was "i" but it was the general syntax I was
            > wanting.
            >
            >
            >>> >> How do I do this using the find or search and replace options ? I
            >>> >> have tried things such as ^.@(a).@$\n and it doesn't work. :-(
            >>>
            >
            >
            >>> >> Using NoteTab Pro 4.95
            >>>
            >
            >
            >> >not sure what you thought the ampersands (@) would do, but circumflex
            >> >before a character in a character class says:
            >> >any character except it ie. [^a] matches NOT "a"
            >> >so ^[^a]+$ matches ... beginning at char 1 a string of NOT a's through
            >> >the end of line ($)
            >>
            >
            > Wow ! Excellent. Thanks for the very speedy/accurate reply, it is very
            > much appreciated. :-) :-) :-)

            Regards ... Alec -- buralex-gmail
            --



            [Non-text portions of this message have been removed]
          • Ben B
            On 2008-02-03 05:30:21 John Fitzsimons wrote regarding; [NTB] Search and replace query. ... ^[^i]+ R HTH Ben
            Message 5 of 7 , Feb 3, 2008
            • 0 Attachment
              On 2008-02-03 05:30:21 John Fitzsimons wrote regarding; "[NTB] Search and replace query."

              > Using your ^[^i]+$ replaced with nothing got me......
              >
              > pinite
              > taipei
              > tiepin
              >
              >
              >
              > inapt
              > inept
              > ionia
              >
              >
              > patio
              >
              > Is there any way I can adapt that to get....
              >
              > pinite
              > taipei
              > tiepin
              > inapt
              > inept
              > ionia

              ^[^i]+\R

              HTH
              Ben
            • John Fitzsimons
              ... Hi Ben, ... That looks very encouraging BUT it doesn t appear to work here. Maybe it is because I am using NoteTab Pro 4.95 ? ^[^i]+ n ALMOST works though.
              Message 6 of 7 , Feb 3, 2008
              • 0 Attachment
                On Sun, 03 Feb 2008 19:11:31 -0800, Ben B wrote:

                >On 2008-02-03 05:30:21 John Fitzsimons wrote regarding; "[NTB] Search and replace query."

                Hi Ben,

                >> Using your ^[^i]+$ replaced with nothing got me......

                >> pinite
                >> taipei
                >> tiepin
                >>
                >>
                >>
                >> inapt
                >> inept
                >> ionia
                >>
                >>
                >> patio

                >> Is there any way I can adapt that to get....

                >> pinite
                >> taipei
                >> tiepin
                >> inapt
                >> inept
                >> ionia
                >
                >^[^i]+\R

                That looks very encouraging BUT it doesn't appear to work here. Maybe
                it is because I am using NoteTab Pro 4.95 ?

                ^[^i]+\n

                ALMOST works though. :-(

                Thank you for your help. Perhaps someone else can work out something
                from your/Alec's contributions ?


                Regards, John.
              • Ben B
                On 2008-02-03 07:28:54 John Fitzsimons wrote regarding; [NTB] Search and replace query. ... Yeah, I think so. Sorry, I missed that. ... Hmm. Looks like it
                Message 7 of 7 , Feb 3, 2008
                • 0 Attachment
                  On 2008-02-03 07:28:54 John Fitzsimons wrote regarding; "[NTB] Search and replace query."

                  > >^[^i]+\R
                  >
                  > That looks very encouraging BUT it doesn't appear to work here. Maybe
                  > it is because I am using NoteTab Pro 4.95 ?

                  Yeah, I think so. Sorry, I missed that.

                  > ^[^i]+\n
                  >
                  > ALMOST works though. :-(

                  Hmm. Looks like it ought to. But I no longer have 4.95 installed to
                  experiment with.

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