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

Re: [Clip] Re: Clip to delete Bible books, chapters and verses

Expand Messages
  • Don - HtmlFixIt.com
    ... Others have given a better solution. To get the ; out, you need to put it in your search string. It is either ; or ; I am not sure which without testing.
    Message 1 of 9 , Oct 16, 2007
    • 0 Attachment
      > I use this clip:
      >
      > ^!Replace {Mat_}{\d+\:\d+\-*\d*} >> WRSA
      >
      Others have given a better solution. To get the ; out, you need to put
      it in your search string.

      It is either ; or \; I am not sure which without testing.

      ^!Replace ;{Mat_}{\d+\:\d+\-*\d*} >> WRSA

      or

      ^!Replace \;{Mat_}{\d+\:\d+\-*\d*} >> WRSA

      But again that only does Mat_ and you have others. The regex solutions
      suggested are broader.
    • jane_sedgewick
      ... advice, but ... works ... but $1 . ... same. ... The reason I used ^([^;]+);(.*)$ instead of ^(.+?);(.+?)$ is that although the results are the same,
      Message 2 of 9 , Oct 16, 2007
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...>
        wrote:
        >
        > muahelp wrote:
        > > I use this clip:
        > > ^!Replace Mat_{\d+\:\d+\-*\d*} >> WRSA
        > > This clip works but leave ;
        > > Help me?
        >
        > I don't get it:
        > a) This only deals with Matthew, your examples included many other
        > books.
        > b) If doing it that way, why look for "Mat_" and not for "; Mat_"?
        >
        > You've not answered my question so I can't really give good
        advice, but
        > Jane's solution is just what I had in mind. One thing though: Hers
        works
        > in version 4.xx.
        > From NoteTab 5.0 upwards the replace string is no longer "\1"
        but "$1".
        >
        > I would have written Jane's version as:
        >
        > ^!Replace "^(.+?);(.+?)$" >> "$1" WRAS
        >
        > If there is exactly one and only one semicolon the results are the
        same.
        > Jane's solution is more specific for finding the first semicolon.
        >
        > Axel

        The reason I used ^([^;]+);(.*)$ instead of ^(.+?);(.+?)$ is that
        although the results are the same, using a lazy match .+? needs to
        backtrack after every letter to check a match and subsequently takes
        64 steps to match any of these lines.
        A negated class ([^;]) will do a match to the semicolon in one move
        and the greedy (.*) after the semicolon moves directly to the end,
        backtracks once to handle the end of line character. This takes only
        8 steps to obtain a match.
        This means in a big file the matches will be made much more
        efficiently, and could impact the time to process.

        Cordially,
        Jane
      • Axel Berger
        ... Jane, do you give lessons (an honest question, from that example you might well be a good teacher) and can I apply for one of your classes? I use the
        Message 3 of 9 , Oct 16, 2007
        • 0 Attachment
          jane_sedgewick wrote:
          > This takes only 8 steps to obtain a match.

          Jane, do you give lessons (an honest question, from that example you
          might well be a good teacher) and can I apply for one of your classes?

          I use the non-greedy version as a matter of course for its reliability
          and because I need not consider side effects as much as with the greedy
          version. (And thiking about side effects tends to be about 90% of the
          work in writing search and replace statements.) But I do appreciate
          that's the sloppy thinking of a bloated Microsoft programmer and it
          lacks any beauty.

          But then an engineer's solution to anything tends to be ugly to look at
          and and in defense I can say that refining a quick one-off hack for
          files of normal length is seldom worth the effort in overall time.

          Axel
        • muahelp
          ... Thanks. These clips works ok now.
          Message 4 of 9 , Oct 17, 2007
          • 0 Attachment
            --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
            >
            > > I use this clip:
            > >
            > > ^!Replace {Mat_}{\d+\:\d+\-*\d*} >> WRSA
            > >
            > Others have given a better solution. To get the ; out, you need to put
            > it in your search string.
            >
            > It is either ; or \; I am not sure which without testing.
            >
            > ^!Replace ;{Mat_}{\d+\:\d+\-*\d*} >> WRSA
            >
            > or
            >
            > ^!Replace \;{Mat_}{\d+\:\d+\-*\d*} >> WRSA
            >
            > But again that only does Mat_ and you have others. The regex solutions
            > suggested are broader.
            >
            Thanks. These clips works ok now.
          Your message has been successfully submitted and would be delivered to recipients shortly.