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

RE: [NTB] Leading ## in ^!InsertText (Moved to Clips)

Expand Messages
  • Art Kocsis
    ... ??? Where is the reference and where does RegEx come in? This is a simple clip statement: ^!InsertText ######Text to be inserted yet the # s are ignored
    Message 1 of 9 , May 2, 2012
    • 0 Attachment
      At 5/2/2012 02:50 PM, John wrote:
      >From: notetab@yahoogroups.com [mailto:notetab@yahoogroups.com] On Behalf
      >Of Art Kocsis
      > >Sent: Wednesday, May 02, 2012 14:44
      > >To: NoteTab-Basic
      > >Subject: [NTB] Leading ## in ^!InsertText
      > >
      > >Leading ## chars in ^!InsertText are not inserted but are ignored/receive
      > >special treatment. IIRC, someone pointed out where in the help files
      > >this was discussed but I can't find it.
      > >
      > >A memory refresher please?
      >
      >They have to be escaped, because they are regex comment lines.

      ???
      Where is the reference and where does RegEx come in?
      This is a simple clip statement: ^!InsertText ######Text to be inserted
      yet the "#"s are ignored and only the following text is inserted.

      AFAICS, RegEx has nothing to do with it. The help file explicitly states
      that the InsertText command accepts "Any text with tokens (^p/^t)".

      Elucidate please.

      Art
    • dans_mill
      Put quote marks around the text string.
      Message 2 of 9 , May 3, 2012
      • 0 Attachment
        Put quote marks around the text string.

        --- In ntb-clips@yahoogroups.com, Art Kocsis <artkns@...> wrote:
        >
        > At 5/2/2012 02:50 PM, John wrote:
        > >From: notetab@yahoogroups.com [mailto:notetab@yahoogroups.com] On Behalf
        > >Of Art Kocsis
        > > >Sent: Wednesday, May 02, 2012 14:44
        > > >To: NoteTab-Basic
        > > >Subject: [NTB] Leading ## in ^!InsertText
        > > >
        > > >Leading ## chars in ^!InsertText are not inserted but are ignored/receive
        > > >special treatment. IIRC, someone pointed out where in the help files
        > > >this was discussed but I can't find it.
        > > >
        > > >A memory refresher please?
        > >
        > >They have to be escaped, because they are regex comment lines.
        >
        > ???
        > Where is the reference and where does RegEx come in?
        > This is a simple clip statement: ^!InsertText ######Text to be inserted
        > yet the "#"s are ignored and only the following text is inserted.
        >
        > AFAICS, RegEx has nothing to do with it. The help file explicitly states
        > that the InsertText command accepts "Any text with tokens (^p/^t)".
        >
        > Elucidate please.
        >
        > Art
        >
      • John Shotsky
        Here is what the help says about it: COMMENTS The sequence (?# marks the start of a comment that continues up to the next closing parenthesis. Nested
        Message 3 of 9 , May 3, 2012
        • 0 Attachment
          Here is what the help says about it:
          COMMENTS

          The sequence (?# marks the start of a comment that continues up to the next closing parenthesis. Nested parentheses are
          not permitted. The characters that make up a comment play no part in the pattern matching at all.

          If the PCRE_EXTENDED option is set, an unescaped # character outside a character class introduces a comment that
          continues to immediately after the next newline in the pattern.

          So, if the insert text line is followed by an unescaped #, it will be seen as a comment, IF pcre extended is set.

          I use ## throughout my clip library to identify sections of document that have been processed. When using Find, or
          replace, the \#\# pattern must be used, or the command simply fails, and in fact you'll find it looking on disk for
          something when it should be looking in the current document. That is, the unescaped ## permits it to leave the current
          document and look in unexpected locations on your disk. Really disconcerting, since you don't know if it did something
          on disk. You don't need to escape the 'output' part of the Replace command though, which should be similar to the
          InsertText command. Maybe it is a bug.

          Regards,
          John
          RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/

          From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Art Kocsis
          Sent: Wednesday, May 02, 2012 16:42
          To: NoteTab-Clips
          Subject: [Clip] RE: [NTB] Leading ## in ^!InsertText (Moved to Clips)


          At 5/2/2012 02:50 PM, John wrote:
          >From: notetab@yahoogroups.com <mailto:notetab%40yahoogroups.com> [mailto:notetab@yahoogroups.com
          <mailto:notetab%40yahoogroups.com> ] On Behalf
          >Of Art Kocsis
          > >Sent: Wednesday, May 02, 2012 14:44
          > >To: NoteTab-Basic
          > >Subject: [NTB] Leading ## in ^!InsertText
          > >
          > >Leading ## chars in ^!InsertText are not inserted but are ignored/receive
          > >special treatment. IIRC, someone pointed out where in the help files
          > >this was discussed but I can't find it.
          > >
          > >A memory refresher please?
          >
          >They have to be escaped, because they are regex comment lines.

          ???
          Where is the reference and where does RegEx come in?
          This is a simple clip statement: ^!InsertText ######Text to be inserted
          yet the "#"s are ignored and only the following text is inserted.

          AFAICS, RegEx has nothing to do with it. The help file explicitly states
          that the InsertText command accepts "Any text with tokens (^p/^t)".

          Elucidate please.

          Art



          [Non-text portions of this message have been removed]
        • flo.gehrke
          ... John, IMHO, you are missing the point in this topic. As Art already said, this is no RegEx issue. So there s nothing to escape here. If ### would
          Message 4 of 9 , May 3, 2012
          • 0 Attachment
            --- In ntb-clips@yahoogroups.com, "John Shotsky" <jshotsky@...> wrote:
            >
            > Here is what the help says about it:
            > COMMENTS
            >
            > The sequence (?# marks the start of a comment that continues up
            > to the next closing parenthesis. Nested parentheses are
            > not permitted. The characters that make up a comment play no part
            > in the pattern matching at all...

            John,

            IMHO, you are missing the point in this topic. As Art already said, this is no RegEx issue. So there's nothing to "escape" here. If '###" would denote a RegEx, then '^!InsertText' wouldn't interprete that "pattern" as a RegEx but would insert it just as a literal string.

            For example: '^!InsertText \r\n' will insert '\r\n' and no CRNL.

            Unfortunately, I can't reproduce that issue -- neither with NT Pro 6.2 nor with 7.0, and I don't have any explanation for that behavior.

            For the time being, a workaround could be...

            ^!InsertText ^!InsertText ^$DecToChar(35)$

            However, workarounds are no explanation...

            Regards,
            Flo
          • flo.gehrke
            ... Sorry, typo! ^!InsertText ^$DecToChar(35)$ of course ;-)
            Message 5 of 9 , May 3, 2012
            • 0 Attachment
              --- In ntb-clips@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
              >

              Sorry, typo!

              ^!InsertText ^$DecToChar(35)$

              of course ;-)
            • Axel Berger
              ... I can t reproduce that, the hashes are inserted just as normal letters be. Is it possible that the issue is not with Clips but with the kind of text you re
              Message 6 of 9 , May 3, 2012
              • 0 Attachment
                Art Kocsis wrote:
                > This is a simple clip statement: ^!InsertText ######Text to be inserted
                > yet the "#"s are ignored and only the following text is inserted.

                I can't reproduce that, the hashes are inserted just as normal letters
                be. Is it possible that the issue is not with Clips but with the kind of
                text you're editing into? Are hashes interpreted as some kind of comment
                sign there?

                Axel
              • Eric Fookes
                Hi Art, ... I can t reproduce this issue. Do you have a some Clip code that demonstrates the problem? -- Regards, Eric Fookes http://www.fookes.com/
                Message 7 of 9 , May 3, 2012
                • 0 Attachment
                  Hi Art,

                  >>> Leading ## chars in ^!InsertText are not inserted but are ignored/receive
                  >>> special treatment. IIRC, someone pointed out where in the help files
                  >>> this was discussed but I can't find it.

                  I can't reproduce this issue. Do you have a some Clip code that
                  demonstrates the problem?

                  --
                  Regards,

                  Eric Fookes
                  http://www.fookes.com/
                • Art Kocsis
                  ... Thanks Flo. My simple workaround was to prepend a space in front of the # s but, as you noted, my question was why the behavior. [see my next post] Art
                  Message 8 of 9 , May 3, 2012
                  • 0 Attachment
                    At 5/3/2012 06:59 AM, Flo wrote:
                    >--- In <mailto:ntb-clips%40yahoogroups.com>ntb-clips@yahoogroups.com,
                    >"John Shotsky" <jshotsky@...> wrote:
                    > > Here is what the help says about it:
                    > > The sequence (?# marks the start of a comment that continues up
                    > > to the next closing parenthesis. Nested parentheses are
                    >
                    >John,
                    >IMHO, you are missing the point in this topic. As Art already said, this
                    >is no RegEx issue. So there's nothing to "escape" here. If '###" would
                    >denote a RegEx, then '^!InsertText' wouldn't interprete that "pattern" as
                    >a RegEx but would insert it just as a literal string.

                    Thanks Flo.

                    My simple workaround was to prepend a space in front of the "#"s but, as
                    you noted, my question was why the behavior. [see my next post]

                    Art
                  • Art Kocsis
                    ... Duh!!! No, the issue is with my eyes and a forgiving script interpreter! I was missing a % in a series of variable names, specifically the % after
                    Message 9 of 9 , May 3, 2012
                    • 0 Attachment
                      At 5/3/2012 07:14 AM, Axel wrote:
                      >Art Kocsis wrote:
                      > > This is a simple clip statement: ^!InsertText ######Text to be inserted
                      > > yet the "#"s are ignored and only the following text is inserted.
                      >
                      >I can't reproduce that, the hashes are inserted just as normal letters
                      >be. Is it possible that the issue is not with Clips but with the kind of
                      >text you're editing into? Are hashes interpreted as some kind of comment
                      >sign there?

                      Duh!!! No, the issue is with my eyes and a "forgiving" script interpreter!

                      I was missing a "%" in a series of variable names, specifically the "%"
                      after the "^%nl" in this code:

                      ^!Set %mark%=######
                      ...
                      ^!Set %ctxt%=^%ctxt%^%nl^%mark% ^%cnt%......

                      Notetab did not flag it as an error but interpreted the ^%nl^%mark% as
                      an undefined (empty) variable. I didn't find this mistake until I extracted
                      and tested my exact code to post here instead of the shortcut example
                      I posted earlier.

                      Sorry for the false alarm

                      Art (slinking sheepishly off into the corner...)
                    Your message has been successfully submitted and would be delivered to recipients shortly.