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

Re: [Clip] Questions about the reg exp. engine. in Notetab

Expand Messages
  • Alan_C
    ... yes, within the regex, only within a regex ^!replace command (or possibly I ve not tried it the interactive replace dialog, unsure on this latter. help
    Message 1 of 9 , Feb 1, 2005
    • 0 Attachment
      dvdwriters12 wrote:
      >
      > I've been trying to work out a few regular expressions that work on
      > a few other programs but don't seem to work on Notetab's reg. exp.
      > engine.
      >
      > Does Notetab support backreferences ?

      yes, within the regex, only within a regex ^!replace command (or
      possibly I've not tried it the interactive replace dialog, unsure on
      this latter.

      help > help contents > click index tab > scroll to regex > tagged match

      ^!replace "<li>{.*}</li>" >> "<b><li>\1</li></b>" ISR

      <li>some_text</li>

      becomes

      <b><li>some_text</li></b>

      \1 refers back to some_text

      some_text was captured in {.*}

      curly brackets in Notetab, not parenthesis. \1 to put it back. can
      have up to 9 I think it says in the help. \1\2\3 . . \9

      backreference outside the regex is not supported. but, instead, U can
      use a ^!find regex and set the found item into a variable

      >
      > <!--sometext:(\w+)\s-->
      [ . . ]
      > also I have a regular expression that spans multiple lines but it
      > doesnt work on Notetab. Does Notetab only support single line
      > regular expressions ?

      If the regex itself, it appears you seek, then, yes the regex itself
      must be all on one line, yes. It can be a rather long line.

      --
      Alan.
    • dvdwriters12
      ... itself ... Thanks Alan that cleared up quite a few things. However I m getting an error with the following:
      Message 2 of 9 , Feb 2, 2005
      • 0 Attachment
        >
        > > <!--sometext:(\w+)\s-->
        > [ . . ]
        > > also I have a regular expression that spans multiple lines but it
        > > doesnt work on Notetab. Does Notetab only support single line
        > > regular expressions ?
        >
        > If the regex itself, it appears you seek, then, yes the regex
        itself
        > must be all on one line, yes. It can be a rather long line.
        >
        > --
        > Alan.

        Thanks Alan that cleared up quite a few things.

        However I'm getting an error with the following:

        <!-- test:{[A-Z0-9]+}\s -->
        <!-- START -->
        {.*?}
        <!-- END -->

        Which works fine in other programs but brings on error in notetab
        about closures.
      • Roy Herring
        Here is an example of multiline regex. Change this Ashworth (970) 262-5858 Banister Shoe (970) 468-8824 Bass (970) 262-2077 To this Ashworth (970) 262-5858
        Message 3 of 9 , Feb 2, 2005
        • 0 Attachment
          Here is an example of multiline regex.

          Change this
          Ashworth
          (970) 262-5858
          Banister Shoe
          (970) 468-8824
          Bass
          (970) 262-2077
          To this
          Ashworth (970) 262-5858
          Banister Shoe (970) 468-8824
          Bass (970) 262-2077
          ^!REPLACE "^{.*}\n{.*}$" >> "\1 \2" rwsati

          Roy

          ----- Original Message -----
          From: "dvdwriters12" <dvdwriters@...>
          To: <ntb-clips@yahoogroups.com>
          Sent: Wednesday, February 02, 2005 6:47 PM
          Subject: Re: [Clip] Questions about the reg exp. engine. in Notetab


          >
          >
          > >
          > > > <!--sometext:(\w+)\s-->
          > > [ . . ]
          > > > also I have a regular expression that spans multiple lines but it
          > > > doesnt work on Notetab. Does Notetab only support single line
          > > > regular expressions ?
          > >
          > > If the regex itself, it appears you seek, then, yes the regex
          > itself
          > > must be all on one line, yes. It can be a rather long line.
          > >
          > > --
          > > Alan.
          >
          > Thanks Alan that cleared up quite a few things.
          >
          > However I'm getting an error with the following:
          >
          > <!-- test:{[A-Z0-9]+}\s -->
          > <!-- START -->
          > {.*?}
          > <!-- END -->
          >
          > Which works fine in other programs but brings on error in notetab
          > about closures.
          >
          >
          >
          >
          >
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          >
          >
          >
        • Alec Burgess
          ... This appears to be the one that gives the closure error. I think in some regex dialects a ? is used to request a non-greedy match but AFAIK in Notetab s
          Message 4 of 9 , Feb 3, 2005
          • 0 Attachment
            dvdwriter:

            > {.*?}

            This appears to be the one that gives the closure error.
            I think in some regex dialects a ? is used to request a non-greedy match but
            AFAIK in Notetab's version "?" is one of three alternate closures ie:
            ? - exactly one
            + - one or more
            * - zero or more

            I don't think its ever legal to have two of these in succession as you do in
            the expression above.

            What did you want/expect it was going to be able to match?

            Regards ... Alec
            --
            ( ) { } [ ] \ | 9 0 + = () {} []


            ---- Original Message ----
            From: "dvdwriters12" <dvdwriters@...>
            To: <ntb-clips@yahoogroups.com>
            Sent: Wednesday, February 02, 2005 20:47
            Subject: [gla: Re: [Clip] Questions about the reg exp.
            engine. in Notetab

            > Thanks Alan that cleared up quite a few things.
            >
            > However I'm getting an error with the following:
            >
            > <!-- test:{[A-Z0-9]+}\s -->
            > <!-- START -->
            > {.*?}
            > <!-- END -->
            >
            > Which works fine in other programs but brings on error in
            > notetab about closures
          • dvdwriters12
            It was meant to match anything between the two tags. {.*?} Its for code for a banner. I want to capture
            Message 5 of 9 , Feb 3, 2005
            • 0 Attachment
              It was meant to match anything between the two tags.

              <!-- test:{[A-Z0-9]+}\s -->
              <!-- START -->
              {.*?}
              <!-- END -->

              Its for code for a banner. I want to capture after scanning where it
              is in the file and change the html code between the two tags with
              something new.

              The html banner code could span multiple lines and could be in diff.
              but its always between those two tags and I search for it with
              test:{[A-Z0-9]+}\s on the line above it.

              It was made before I heard about Notetab and was the only way to do
              it.

              >
              > the expression above.
              >
              > What did you want/expect it was going to be able to match?
              >
              > Regards ... Alec
              > --
              > ( ) { } [ ] \ | 9 0 + = () {} []
              >
              >

              > > <!-- test:{[A-Z0-9]+}\s -->
              > > <!-- START -->
              > > {.*?}
              > > <!-- END -->
              > >
              > > Which works fine in other programs but brings on error in
              > > notetab about closures
            • Alec Burgess
              Hi dvdwriter: If you *know* that there is just one occurence of in the document then this should allow you to replace everything between the START
              Message 6 of 9 , Feb 3, 2005
              • 0 Attachment
                Hi dvdwriter:

                If you *know* that there is just one occurence of <!-- END --> in the
                document then this should allow you to replace everything between the START
                and END tags by "whatever":

                ^!replace "{<!-- START -->}{\a*}{<!-- END -->}" >> "\1whatever\3" rws

                If you have to worry about multiple <!-- END --> tags you could modify the
                "Select between tags" clip in the Utilities library.
                Regards ... Alec
                --
                ( ) { } [ ] \ | 9 0 + = () {} []


                ---- Original Message ----
                From: "dvdwriters12" <dvdwriters@...>
                To: <ntb-clips@yahoogroups.com>
                Sent: Thursday, February 03, 2005 08:59
                Subject: [gla: Re: [Clip] Questions about the reg exp.
                engine. in Notetab

                > It was meant to match anything between the two tags.
                >
                > <!-- test:{[A-Z0-9]+}\s -->
                > <!-- START -->
                > {.*?}
                > <!-- END -->
                >
                > Its for code for a banner. I want to capture after
                > scanning where it is in the file and change the html code
                > between the two tags with something new.
                >
                > The html banner code could span multiple lines and could
                > be in diff. but its always between those two tags and I
                > search for it with test:{[A-Z0-9]+}\s on the line above
                > it.
                >
                > It was made before I heard about Notetab and was the only
                > way to do it.
              • Alan_C
                Hi, Great ideas Alec shared. Follows, just an idea (that s all, nothing more) U decide if is feasible: (this might be if there are or happen to be more than
                Message 7 of 9 , Feb 3, 2005
                • 0 Attachment
                  Hi,

                  Great ideas Alec shared.

                  Follows, just an idea (that's all, nothing more) U decide if is feasible:

                  (this might be if there are or happen to be more than one of the start
                  or end tags)

                  If dvdwriter knows how many lines the banner spans

                  then, find the start tag then jump select a few lines then replace ^p
                  (remove the line breaks) then would have one line to process

                  Not that it's a MUST to have one line to process with a regex. But the
                  default record separator in Notetab is the line break (meaning that the
                  regex grabs one line at a time) unless you pass something to it like
                  Alec did there to make it do otherwise but then also I think, careful,
                  as Alec mentioned, of the greed issue.

                  dvdwriter I wasn't sure that I had it straight what U seeking earlier:
                  yes the regex command/code must be a one liner. More, though the
                  default record separator is the line break (easier to regex when
                  processing snags one line at a time), it is possible to make it process
                  so as to go beyond the default setting. | Alan.

                  Alec Burgess wrote:
                  > Hi dvdwriter:
                  >
                  > If you *know* that there is just one occurence of <!-- END --> in the
                  > document then this should allow you to replace everything between the START
                  > and END tags by "whatever":
                  >
                  > ^!replace "{<!-- START -->}{\a*}{<!-- END -->}" >> "\1whatever\3" rws
                  >
                  > If you have to worry about multiple <!-- END --> tags you could modify the
                  > "Select between tags" clip in the Utilities library.
                  > Regards ... Alec
                  ---- Original Message ---- From: "dvdwriters12" <dvdwriters@...>
                  To: <ntb-clips@yahoogroups.com> Sent: Thursday, February 03, 2005 08:59
                  Subject: [gla: Re: [Clip] Questions about the reg exp. engine. in Notetab
                  >> It was meant to match anything between the two tags.
                  >>
                  >> <!-- test:{[A-Z0-9]+}\s -->
                  >> <!-- START -->
                  >> {.*?}
                  >> <!-- END -->
                  >>
                  >> Its for code for a banner. I want to capture after
                  >> scanning where it is in the file and change the html code
                  >> between the two tags with something new.
                  >>
                  >> The html banner code could span multiple lines and could
                  >> be in diff. but its always between those two tags and I
                  >> search for it with test:{[A-Z0-9]+}\s on the line above
                  >> it.
                • dvdwriters12
                  Hi Alec, Your find / replace does work but it s not very useful as I have more than one banner on a page and using it deletes the rest of the banners. I m not
                  Message 8 of 9 , Feb 4, 2005
                  • 0 Attachment
                    Hi Alec,

                    Your find / replace does work but it's not very useful as I have
                    more than one banner on a page and using it deletes the rest of the
                    banners.

                    I'm not sure why Notetab is the only program that thinks

                    {.*?}

                    is not legal.

                    Cheers


                    --- In ntb-clips@yahoogroups.com, "Alec Burgess" <burale@a...> wrote:
                    > Hi dvdwriter:
                    >
                    > If you *know* that there is just one occurence of <!-- END --> in
                    the
                    > document then this should allow you to replace everything between
                    the START
                    > and END tags by "whatever":
                    >
                    > ^!replace "{<!-- START -->}{\a*}{<!-- END -->}" >> "\1whatever\3"
                    rws
                    >
                    > If you have to worry about multiple <!-- END --> tags you could
                    modify the
                    > "Select between tags" clip in the Utilities library.
                    > Regards ... Alec
                  Your message has been successfully submitted and would be delivered to recipients shortly.