Community
    • Login

    Notepad++ attempting to find specific text within brackets

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    regex
    8 Posts 4 Posters 225 Views
    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.
    • cs DavisC
      cs Davis
      last edited by PeterJones

      Hello,
      I am attempting a search with Notepad++
      I am trying to find all lines that include finished and LOGN_LEVEL_1[-1]
      sample line below

      02:20:11.054|gis.dovv    |lert |overout.lsp   |0105|"unearthing du upon finished: DUPIL[2180500000001874] GLYY[1743142790.88] bred[ %%%%%% ] predi[12234143] NUTS[1573.51] LOGN_LEVEL_1[-1] MOTOR[1] "
      

      I have tried (?i-s)^(?=.*finished)(?=.*LOGN_LEVEL_1[-1] ).+
      but dosen’t seem to find.
      Seems to me that there is something about the “[-1]”
      Thanks

      —

      moderator added code markdown around text; please don’t forget to use the </> button to mark example text as “code” so that characters don’t get changed by the forum

      Terry RT Alan KilbornA 3 Replies Last reply Reply Quote 0
      • Terry RT Terry R moved this topic from Notepad++ & Plugin Development on
      • Terry RT
        Terry R @cs Davis
        last edited by

        @cs-Davis
        I’ve just moved your post to the “Help Wanted” category. Plugin Development was the wrong category for this question. Additionally if you were to read the FAQ post for how to correctly post examples so the posting engine doesn’t mangle them, please read this post.

        Terry

        1 Reply Last reply Reply Quote 2
        • Alan KilbornA
          Alan Kilborn @cs Davis
          last edited by Alan Kilborn

          @cs-Davis said in Notepad++ attempting to find specific text within brackets:

          Seems to me that there is something about the “[-1]”

          Yep. You need to escape the square brackets, e.g. \[-1\]

          cs DavisC 1 Reply Last reply Reply Quote 2
          • Terry RT
            Terry R @cs Davis
            last edited by

            @cs-Davis said in Notepad++ attempting to find specific text within brackets:

            Seems to me that there is something about the “[-1]

            They are special, we call them meta-characters. There is a reference here. meta-characters need the escape character to make them “literal”. More reading about how to write regular expressions likely needed.

            Terry

            1 Reply Last reply Reply Quote 2
            • cs DavisC
              cs Davis @Alan Kilborn
              last edited by PeterJones

              @Alan-Kilborn
              Thanks Alan,
              I did try

              (?i-s)^(?=.*finished)(?=.*ATRI_LEVEL_1 \[-1\] ).+
              

              might you see anything else that I might be missing?
              Thanks for your suggestion

              —

              moderator added code markdown around text; please don’t forget to use the </> button to mark example text as “code” so that characters don’t get changed by the forum

              Terry RT CoisesC 2 Replies Last reply Reply Quote 1
              • Terry RT
                Terry R @cs Davis
                last edited by

                @cs-Davis said in Notepad++ attempting to find specific text within brackets:

                might you see anything else that I might be missing?

                In the first instance, why not load your expression and example data in regex101.com. Make sure the flavour of regular expression is PCRE, because the Boost regular expression engine (which Notepad++ uses) relates most closely with that, see this FAQ post.

                Beyond that there is this FAQ post which has lots of links for support of regular expressions (all flavours).

                Terry

                1 Reply Last reply Reply Quote 0
                • CoisesC
                  Coises @cs Davis
                  last edited by Coises

                  @cs-Davis said in Notepad++ attempting to find specific text within brackets:

                  (?i-s)^(?=.*finished)(?=.*ATRI_LEVEL_1 \[-1\] ).+
                  

                  might you see anything else that I might be missing?

                  Well, in the post, it looks like you typo’d ATRI for LOGN, but you probably didn’t do that in your test.

                  However, unless this is also a typo, the space between _1 and \[ would be interpreted as something that has to match; if, as in your sample data, there is no space, there can’t be one in your pattern, either.

                  cs DavisC 1 Reply Last reply Reply Quote 2
                  • cs DavisC
                    cs Davis @Coises
                    last edited by

                    @Coises
                    Thanks much Coises, dang too easy to overlook a simple space, its almost like trying to figure out a sound problem when it was the mute button that was hit.
                    Thanks again

                    1 Reply Last reply Reply Quote 1
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors