Community
    • Login

    Search positive + egative (in-/exclude)

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    9 Posts 2 Posters 731 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.
    • Uwe RecknagelU
      Uwe Recknagel
      last edited by

      Hi there,
      i got a number of configuration files that always come with identical commands lines but different values to it.

      For example, it always has the paramter ‘notification_days_ahead’ - I need to ensure it always gets a certain value (e.g. 5) set to it but only if it it reads any other value than 5.

      The line replacement I already figured out but the selective selection not quite …

      May be a simple selection term but I dont get it.
      Thanks a good hint!
      Uwe

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Uwe Recknagel
        last edited by Alan Kilborn

        @Uwe-Recknagel

        Your data is incomplete, so your question can’t be answered with certainty. Please see FAQ for how to ask such questions properly.

        However, let’s assume your data looks like this: notification_days_ahead=27. In this case, you would:

        Find: notification_days_ahead=\d+
        Replace: notification_days_ahead=5
        Search mode: Regular expression

        It doesn’t really matter if your data is already 5, because what I’ve given you would just replace that with 5 anyway.

        Uwe RecknagelU 1 Reply Last reply Reply Quote 1
        • Uwe RecknagelU
          Uwe Recknagel @Alan Kilborn
          last edited by

          @Alan-Kilborn
          Hi Alan, Thanks for looking into this!
          Actually, the FAQ etc - I felt overwhelmed + lost surely due to my missing background…

          In the files the command line in question looks like this
          Bei_Kontraktverfall_warnen_Tage=4

          Since I am keen on touching only those files where the value in this line is not 4, I think I need to have the positive FIND (of the line in general) and then added the exclusion (‘where value is not 4’).
          Does that explain the matter a bit more?

          Thanks!

          Alan KilbornA 2 Replies Last reply Reply Quote 0
          • Alan KilbornA
            Alan Kilborn @Uwe Recknagel
            last edited by

            @Uwe-Recknagel said in Search positive + egative (in-/exclude):

            I am keen on touching only those files where the value in this line is not 4
            Does that explain the matter a bit more?

            I thought it was 5, not 4, but…no matter.

            If the concern is about touching files, we can restrict it to non-5 (I’m sticking with 5) data.

            1 Reply Last reply Reply Quote 0
            • Alan KilbornA
              Alan Kilborn @Uwe Recknagel
              last edited by

              @Uwe-Recknagel

              Find: notification_days_ahead=(?!5\D)\d+

              Uwe RecknagelU 1 Reply Last reply Reply Quote 3
              • Uwe RecknagelU
                Uwe Recknagel @Alan Kilborn
                last edited by

                @Alan-Kilborn
                Hey Alan, Thanks a lot, that tackles this one quite nicely!

                Looking further into the file other parameters it apparently doesn’t catch this way - e.g.
                fixed_Lot=0.10000000 or fixed_Lot=0.1 (or a variable number of zeros) - I need to check for a value = -1 (to deactivate te paramter).
                Replacing in your statement the number 4 by -1 doesnt return a beneficial result. May it be due to -1 is recognised as a different format than 4?

                Thanks again for strechting your time!
                Uwe

                Alan KilbornA 1 Reply Last reply Reply Quote 0
                • Alan KilbornA
                  Alan Kilborn @Uwe Recknagel
                  last edited by

                  @Uwe-Recknagel

                  Well, you see, you keep growing the “spec” for what you need. You get a couple of freebies from us here (because really we just want regular-expression questioners to “go away quickly” – we’re more interested in really Notepad++ specific discussions).

                  After your freebies are exhausted, or sometimes even before, we advise you to read FAQ about regular expressions, found HERE, so you can “roll your own”. You gain powerful knowledge, we get back to better Notepad++ topics. Win/win. :-)

                  Uwe RecknagelU 1 Reply Last reply Reply Quote 0
                  • Uwe RecknagelU
                    Uwe Recknagel @Alan Kilborn
                    last edited by

                    @Alan-Kilborn
                    alright, I see. the FAQ I read in parallel, trying to understand+translate your input.
                    Thanks!

                    Alan KilbornA 1 Reply Last reply Reply Quote 0
                    • Alan KilbornA
                      Alan Kilborn @Uwe Recknagel
                      last edited by

                      @Uwe-Recknagel

                      As an additional hint, the information found HERE seems directly applicable to an aspect of the problem you are trying to solve.

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