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

Re: [NTB] Searching text for large list of keywords - how best?

Expand Messages
  • Don Daugherty
    Since Regular Expressions are discussed a lot on the Clips list, and since I think using a clip to build the search string from a text file could be the
    Message 1 of 7 , Sep 29, 2003
    • 0 Attachment
      Since Regular Expressions are discussed a lot on the Clips list, and since I
      think using a clip to build the search string from a text file could be the
      optimum solution to your problem, I would urge you to subscribe and re-ask
      your question there.
    • Theo Brueton
      ... Thanks, Don, suggestion noted! TB
      Message 2 of 7 , Sep 29, 2003
      • 0 Attachment
        At 09:17 29/09/03 -0500, Don Daugherty wrote:
        > ... Clips list ... re-ask your question there.

        Thanks, Don, suggestion noted!

        TB
      • Theo Brueton
        ... At 18:35 29/09/03 -0400, Alec Burgess wrote: [[Subject: Re: [NTB] How to replace a string containing quote characters]] ... Now I m almost confused! OK,
        Message 3 of 7 , Sep 29, 2003
        • 0 Attachment
          At 09:17 29/09/03 -0500, Don Daugherty wrote:
          > ... Clips list ... re-ask your question there.

          At 18:35 29/09/03 -0400, Alec Burgess wrote:
          [[Subject: Re: [NTB] How to replace a string containing quote characters]]
          >Usually REGEXP including anything that can be done in the Find/Replace
          >dialog is fair game for the basic forum (this one). When it gets more
          >complicated it goes to clips list.

          Now I'm almost confused!

          OK, I'll try asking 3 simple (?) questions here just in case...

          What is the maximum length of a REGEXP (if any)?

          Does this apply to the Reg. expr: input in the Search:Find box ?

          Here are two lines from Alec's message which
          will illustrate my third question:
          <quote>
          Find=(example1)|(example2)|(example3)|( example4)
          Replace=new value1
          </quote>
          If I copy the whole of this message into Note Tab Light,
          click on Search:Find:,
          set regexp,
          paste this string -
          \w(expr)|(replace)|(example)
          - into the Reg. expr: field in the Find box,
          and press Find Next repeatedly, the find gets stuck
          on a match where the matched text includes a trailing
          blank on the previous line.

          Is this a bug or a feature? ;)
          (PS is there a workround?)

          Regards, Theo
        • Alec Burgess
          Theo: Find=(example1)|(example2)|(example3)|( example4) Replace=new value1 ... I saw your second message saying you d figured out what was
          Message 4 of 7 , Sep 29, 2003
          • 0 Attachment
            Theo:

            <quote>
            Find=(example1)|(example2)|(example3)|( example4)
            Replace=new value1
            </quote>

            ......

            > Is this a bug or a feature? ;)
            > (PS is there a workround?)

            I saw your second message saying you'd figured out what was happening - I'm
            assuming that part is OK.

            > What is the maximum length of a REGEXP (if any)?

            None that I know of - except for the maximum length of a paragrah (around
            32K in Pro - I vaguely remember its different in either Notetab light or
            standard.

            > Does this apply to the Reg. expr: input in the Search:Find box ?

            Again, AFAIK its the same as above.

            When it gets too big to easily follow even with the Find or Find/Replace
            dialogs resized and the font size increased for visibility I generally code
            a one line clip of the form (forgive me Jody :-) )

            ^!replace "some long complex expression to find" >> "probably something much
            smaller to replace" rwsa

            >> Usually REGEXP including anything that can be done in the
            >> Find/Replace dialog is fair game for the basic forum (this one).
            >> When it gets more complicated it goes to clips list.
            >
            > Now I'm almost confused!
            >
            > OK, I'll try asking 3 simple (?) questions here just in case...

            If you still have remaining questions it would probably be best to switch to
            clips list ... Jody's not hard-nosed about it but use of regular expressions
            falls in the grey area since many (most?) users would prefer to ignore their
            existence totally :-)

            Regards ... Alec
            --

            ---- Original Message ----
            From: "Theo Brueton" <tbya@...>
            To: <notetab@yahoogroups.com>
            Sent: Monday, September 29, 2003 20:43
            Subject: [gla: Re: [NTB] Searching text for large list of keywords -
            how best?

            > At 09:17 29/09/03 -0500, Don Daugherty wrote:
            >> ... Clips list ... re-ask your question there.
            >
            > At 18:35 29/09/03 -0400, Alec Burgess wrote:
            > [[Subject: Re: [NTB] How to replace a string containing quote
            > characters]]
          • Theo Brueton
            ... Alex - Nonono, it s not OK! Try it and see. But YMMV. (Your Mileage May Vary) ... Thank you for the helpful info and suggestions. Regards, Theo
            Message 5 of 7 , Sep 30, 2003
            • 0 Attachment
              At 01:41 30/09/03 -0400, Alec Burgess wrote:
              >I saw your second message saying you'd figured out what was happening - I'm
              >assuming that part is OK.

              Alex -

              Nonono, it's not OK! Try it and see. But YMMV. (Your Mileage May Vary)

              >> What is the maximum length of a REGEXP (if any)?
              >
              >None that I know of [...]

              Thank you for the helpful info and suggestions.

              Regards, Theo
            • hugo_paulissen
              ... Theo, I m not sure if this is what you are after but you could try it with something like: n* w*(example1)|(example2)|(example3)|(example4) Apparently
              Message 6 of 7 , Sep 30, 2003
              • 0 Attachment
                > <quote>
                > Find=(example1)|(example2)|(example3)|( example4)
                > Replace=new value1
                > </quote>
                > If I copy the whole of this message into Note Tab Light,
                > click on Search:Find:,
                > set regexp,
                > paste this string -
                > \w(expr)|(replace)|(example)
                > - into the Reg. expr: field in the Find box,
                > and press Find Next repeatedly, the find gets stuck
                > on a match where the matched text includes a trailing
                > blank on the previous line.
                >
                > Is this a bug or a feature? ;)
                > (PS is there a workround?)


                Theo,

                I'm not sure if this is what you are after but you could try it with
                something like:

                \n*\w*(example1)|(example2)|(example3)|(example4)

                Apparently your construction with "\w(expr)|etc" chokes on the
                trailing blank/new line character. Please note that the Regular
                Expression-engine may cause hickups if you construct complex
                expressions. It is always safe to make a backup first.

                Hugo
              • Theo Brueton
                At 21:10 30/09/03 -0000, hugo_paulissen wrote: I m not sure if this is what you are after but you could try it with ... Interesting! A string in the form
                Message 7 of 7 , Oct 1, 2003
                • 0 Attachment
                  At 21:10 30/09/03 -0000, hugo_paulissen wrote:
                  I'm not sure if this is what you are after but you could try it with
                  >something like:
                  >
                  >\n*\w*(example1)|(example2)|(example3)|(example4)
                  >
                  >Apparently your construction with "\w(expr)|etc" chokes on the
                  >trailing blank/new line character.

                  Interesting!

                  A string in the form following your suggestion, ie
                  \n*\w*(expr)|(replace)|(example)
                  doesn't "choke"; but it only finds matches occurring at the start
                  of a line. Thus it seems that the * (match 0 or more) doesn't
                  work as advertised here!

                  However,
                  ((\n)|(\w))(expr)|(replace)|(example)
                  seems to produce the result I am looking for!

                  (I don't understand the need for
                  the inner brackets in ((\n)|(\w)) ]

                  So, thank you very much Hugo!

                  >Please note that the Regular
                  >Expression-engine may cause hickups if you construct complex
                  >expressions.

                  Oh dear, is this a regular "feature"?

                  I'm not sure that the expression I'm after is/should really be
                  complex - I'm just trying to find matches with a list of keywords.
                  (But unless you put a \w or similar at the beginning you'll generally get
                  "false" matches, where a keyword forms part of a longer word)

                  >It is always safe to make a backup first.

                  Indeed.

                  Regards, Theo
                Your message has been successfully submitted and would be delivered to recipients shortly.