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

Re: [Clip] Trivial clip

Expand Messages
  • Alec Burgess
    Actually Ian, John has it correctly though I probably would have done it the way you suggest. The K escape sequence erases anything that has been found up to
    Message 1 of 14 , Feb 18, 2013
    • 0 Attachment
      Actually Ian, John has it correctly though I probably would have done it
      the way you suggest.
      The \K escape sequence erases anything that has been found up to the
      place it appears but leaves any previously established groups available
      for use in replacement.

      from Google [pcre escape sequence "\K"]
      http://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions
      I know what follows is somewhere(?) in Notetab - Help - Help on Regular
      Expressions but its hard to search for \K

      Look-ahead and look-behind assertions
      Patterns may assert that previous text or subsequent text contains a
      pattern without consuming matched text (zero-width assertion). For
      example, /\w+(?=\t)/ matches a word followed by a tab, without
      including the tab.
      Look-behind assertions cannot be of uncertain length.
      Since version 7.2, \K can be used in a pattern to reset the start of
      the current whole match. This provides a flexible alternative
      approach to look-behind assertions because the discarded part of the
      match (the part that precedes \K) need not be fixed in length.

      FWIW: I tested it just to be sure - if you use the Replace dialog and
      step through with [Find] you see nothing apparently selected but each
      [Replace] doubles the line. (Thx Flo, I think for finally ramming \K
      usage through my head - once grokked it can prove very useful)

      On 2013-02-18 23:19, Ian NTnerd wrote:
      > I'm no ReGex expert but shouldn't there be two $1 in the output. I think
      > it is just a typo and he meant,
      >
      > ^!Replace "^(.+)\K$" >> "$1\x20$1" ARSW
      >
      > No time to test it.
      >
      > Ian
      >
      > On 19/02/2013 7:55 AM, John Shotsky wrote:
      > >
      > > The following should do what you request:
      > > ^!Replace "^(.+)\K$" >> "\x20$1" ARSW
      --
      Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)


      [Non-text portions of this message have been removed]
    • Ian NTnerd
      Thanks, another RE dark art revealed. Ian ... [Non-text portions of this message have been removed]
      Message 2 of 14 , Feb 19, 2013
      • 0 Attachment
        Thanks, another RE dark art revealed.

        Ian

        On 19/02/2013 12:35 PM, John Shotsky wrote:
        >
        > No, the \K means to leave the first one in place. No need to copy what
        > is already there.
        >
        > Regards,
        > John
        > RecipeTools Web Site: http://recipetools.gotdns.com/>
        > http://recipetools.gotdns.com/
        > John's Mags Yahoo Group: http://groups.yahoo.com/group/johnsmags/>
        > http://groups.yahoo.com/group/johnsmags/
        >
        > From: ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com>
        > [mailto:ntb-clips@yahoogroups.com
        > <mailto:ntb-clips%40yahoogroups.com>] On Behalf Of Ian NTnerd
        > Sent: Monday, February 18, 2013 20:20
        > To: ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com>
        > Subject: Re: [Clip] Trivial clip
        >
        >
        > I'm no ReGex expert but shouldn't there be two $1 in the output. I think
        > it is just a typo and he meant,
        >
        > ^!Replace "^(.+)\K$" >> "$1\x20$1" ARSW
        >
        > No time to test it.
        >
        > Ian
        >
        > On 19/02/2013 7:55 AM, John Shotsky wrote:
        > >
        > > The following should do what you request:
        > > ^!Replace "^(.+)\K$" >> "\x20$1" ARSW
        > >
        > > Regards,
        > > John
        > > RecipeTools Web Site: http://recipetools.gotdns.com/>
        > > http://recipetools.gotdns.com/
        > > John's Mags Yahoo Group: http://groups.yahoo.com/group/johnsmags/>
        > > http://groups.yahoo.com/group/johnsmags/
        > >
        > > From: ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com>
        > > [mailto:ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com>
        > > ] On Behalf Of bruce.somers@... <mailto:bruce.somers%40web.de>
        > >
        > > Sent: Monday, February 18, 2013 15:45
        > > To: ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com>
        > > Subject: [Clip] Trivial clip
        > >
        > >
        > >
        > > Greetinge!
        > >
        > > I have a very simple problem that certainly should be solvable with
        > > the help of NoteTab Clips. I haven't been successful in extracting
        > > information from the Help facility. As usual, those who know what to
        > > look for, need no help!
        > >
        > > I want simply to select the entire text of each line of an open file,
        > > and append that text to that same line, that is, I want to tranform
        > >
        > > This is line one
        > > This one is line two
        > > This is line three
        > >
        > > into
        > >
        > > This is line one This is line one
        > > This one is line two This one is line two
        > > This is line three This is line three
        > >
        > > If some kind soul will show me how to do that, I'll try to develop
        > > from there.
        > >
        > > Many thanks for any assistance.
        > >
        > > Bruce
        > >
        > > [Non-text portions of this message have been removed]
        > >
        > >
        >
        > [Non-text portions of this message have been removed]
        >
        > [Non-text portions of this message have been removed]
        >
        >



        [Non-text portions of this message have been removed]
      • bruce.somers
        I  seem to have misunderstood. I assumed that the command  ^!Replace ^(.+) K$ $1 x20$1 ARSW  was to be pasted into the  Reg Expr -field of the
        Message 3 of 14 , Feb 23, 2013
        • 0 Attachment
          I  seem to have misunderstood.

          I assumed that the command  ^!Replace "^(.+)\K$" >> "$1\x20$1" ARSW  was to be pasted into the  'Reg Expr'-field of the 'Find and Replace' dialog box. But that leads to the nessage

          '^!Replace "^(.+)\K$" >> "$1\x20$1" ARSW'  not found between current position and end of document.

          I must be way off base.

          Bruce


          On 19/02/2013 7:55 AM, John Shotsky wrote:
          >
          > The following should do what you request:
          > ^!Replace "^(.+)\K$" >> "\x20$1" ARSW
        • John Shotsky
          It was written as a clip that you can use whenever you want. If you want to use the dialog, you would place ^(.+) K$ in the find dialog and x20$1 in the
          Message 4 of 14 , Feb 23, 2013
          • 0 Attachment
            It was written as a clip that you can use whenever you want. If you want to use the dialog, you would place
            ^(.+)\K$
            in the find dialog and
            \x20$1
            in the replace dialog.
            Make sure the dropdown is set for regular expressions, then 'Replace All'.

            Regards,
            John
            RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/
            John's Mags Yahoo Group: <http://groups.yahoo.com/group/johnsmags/> http://groups.yahoo.com/group/johnsmags/

            From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of bruce.somers@...
            Sent: Saturday, February 23, 2013 13:44
            To: ntb-clips@yahoogroups.com
            Subject: Re: [Clip] Trivial clip


            I seem to have misunderstood.

            I assumed that the command ^!Replace "^(.+)\K$" >> "$1\x20$1" ARSW was to be pasted into the 'Reg Expr'-field of the 'Find and Replace' dialog box. But that leads to the nessage

            '^!Replace "^(.+)\K$" >> "$1\x20$1" ARSW' not found between current position and end of document.

            I must be way off base.

            Bruce

            On 19/02/2013 7:55 AM, John Shotsky wrote:
            >
            > The following should do what you request:
            > ^!Replace "^(.+)\K$" >> "\x20$1" ARSW



            [Non-text portions of this message have been removed]
          • bruce.somers
            OK -clear enough. Thanks again, John. Bruce   It was written as a clip that you can use whenever you want. If you want to use the dialog, you would place
            Message 5 of 14 , Feb 23, 2013
            • 0 Attachment
              OK -clear enough.

              Thanks again, John.

              Bruce

               

              It was written as a clip that you can use whenever you want. If you want to use the dialog, you would place
              ^(.+)\K$
              in the find dialog and
              \x20$1
              in the replace dialog.
              Make sure the dropdown is set for regular expressions, then 'Replace All'.

              Regards,
              John


              I seem to have misunderstood.

              I assumed that the command ^!Replace "^(.+)\K$" >> "$1\x20$1" ARSW was to be pasted into the 'Reg Expr'-field of the 'Find and Replace' dialog box. But that leads to the nessage

              '^!Replace "^(.+)\K$" >> "$1\x20$1" ARSW' not found between current position and end of document.

              I must be way off base.

              Bruce

              On 19/02/2013 7:55 AM, John Shotsky wrote:
              >
              > The following should do what you request:
              > ^!Replace "^(.+)\K$" >> "\x20$1" ARSW

              [Non-text portions of this message have been removed]
            Your message has been successfully submitted and would be delivered to recipients shortly.