Community
    • Login

    search inside brackets

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 1.6k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Anita NieuwA Offline
      Anita Nieuw
      last edited by

      hi all,

      can any one help me?

      in a RTF file I want to find all “\hich\af1\dbch\af31505\loch\f1” (or part of it) inside the brackets “[ ]”.

      in this example: [NAW_NAW\hich\af1\dbch\af31505\loch\f1 1]   and    [STARTSECTIE:STORNOS(AND STOR.AANNR=[BZWSCHRIFT_AAN\hich\af1\dbch\af31505\loch\f1 NR])]

      \fs19\lang1024\langfe1024\langnp2057\insrsid10121777 {*\bkmkstart blwaan}
      \par \hich\af1\dbch\af31505\loch\f1 [STARTSECTIE:NAW(and snaw.subjectnr = [BZWSCHRIFT_GEMACHTIGDENR])][NAW_NAW\hich\af1\dbch\af31505\loch\f1 1]\line [NAW_NAW2]}{\rtlch\fcs1 \af1 \ltrch\fcs0 \lang1024\langfe1024\langnp2057\insrsid10121777
      \par }\pard\plain \ltrpar\s25\ql \li0\ri0\sl280\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9908172 \rtlch\fcs1 \af1\afs19\alang1025 \ltrch\fcs0
      \fs19\lang1024\langfe1024\loch\af1\hich\af1\dbch\af31505\cgrid\noproof\langnp1043\langfenp1043 {\rtlch\fcs1 \af1 \ltrch\fcs0 \lang1024\langfe1024\langnp2057\insrsid10121777 \hich\af1\dbch\af31505\loch\f1 [NAW_NAW3]\line {*\bkmkend blwaan}
      \hich\af1\dbch\af31505\loch\f1 [BETALING_REEDSBET]}{\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid8744553 \tab }{\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid3617139 \hich\af1\dbch\af31505\loch\f1
      -[EINDESECTIE:BETALING] [STARTSECTIE:STORNOS(AND STOR.AANNR=[BZWSCHRIFT_AAN\hich\af1\dbch\af31505\loch\f1 NR])]\tab \hich\af1\dbch\af31505\loch\f1 [STARTSECTIE:DUMMY(where ‘[STORNOS_REEDSTER1]’ > ‘0’)]
      \par }\pard\plain \ltrpar\ql \li0\ri0\sl-280\slmult0\widctlpar\tx5387\tqr\tx7088\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af1\afs19\alang1025 \ltrch\fcs0

      1 Reply Last reply Reply Quote 0
      • guy038G Offline
        guy038
        last edited by

        Hello, @anita-nieuw and All,

        I noticed, in your text, that the string \hich\af1\dbch\af31505\loch\f1 is located, principally, near a closing square bracket ]

        So, here is a possible regex to match this string inside a brackets block :

        SEARCH (?-i)\Q\hich\af1\dbch\af31505\loch\f1\E(?=[^\r\n[]*?\])

        Of course, you must set the Regular expression search mode !


        Notes :

        • First, the modifier (?-i) forces a NON-insensitive to case search

        • Then, the part \Q\hich\af1\dbch\af31505\loch\f1\E, due to the boundaries \Q and \E, looks for the literal range of characters, between them

        • But an overall match implies that the look-ahead (?=[^\r\n[]*?\]), in other words, the condition is true.

        • That is to say, that, after the string \hich\af1\dbch\af31505\loch\f1, there is, further on, a closing square bracket ] and between, the shortest optional range of characters, different from, either, the opening square bracket [ and the End of Line characters \r and \n

        • For instance, for your two occurrences, found in your example, the [^\r\n[]*? part of the regex matches a space character followed by the digit 1 or the string NR, both, right before the ]

        Best Regards,

        guy038

        1 Reply Last reply Reply Quote 0
        • Anita NieuwA Offline
          Anita Nieuw
          last edited by

          GREAT, thank you very, very much! I’m happy :)

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors