• Login
Community
  • Login

Search positive + egative (in-/exclude)

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
9 Posts 2 Posters 1.5k 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.
  • U
    Uwe Recknagel
    last edited by Sep 5, 2022, 3:00 PM

    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

    A 1 Reply Last reply Sep 5, 2022, 3:10 PM Reply Quote 0
    • A
      Alan Kilborn @Uwe Recknagel
      last edited by Alan Kilborn Sep 5, 2022, 3:11 PM Sep 5, 2022, 3:10 PM

      @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.

      U 1 Reply Last reply Sep 5, 2022, 5:43 PM Reply Quote 1
      • U
        Uwe Recknagel @Alan Kilborn
        last edited by Sep 5, 2022, 5:43 PM

        @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!

        A 2 Replies Last reply Sep 5, 2022, 6:58 PM Reply Quote 0
        • A
          Alan Kilborn @Uwe Recknagel
          last edited by Sep 5, 2022, 6:58 PM

          @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
          • A
            Alan Kilborn @Uwe Recknagel
            last edited by Sep 5, 2022, 7:07 PM

            @Uwe-Recknagel

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

            U 1 Reply Last reply Sep 6, 2022, 11:39 AM Reply Quote 3
            • U
              Uwe Recknagel @Alan Kilborn
              last edited by Sep 6, 2022, 11:39 AM

              @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

              A 1 Reply Last reply Sep 6, 2022, 12:24 PM Reply Quote 0
              • A
                Alan Kilborn @Uwe Recknagel
                last edited by Sep 6, 2022, 12:24 PM

                @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. :-)

                U 1 Reply Last reply Sep 6, 2022, 12:44 PM Reply Quote 0
                • U
                  Uwe Recknagel @Alan Kilborn
                  last edited by Sep 6, 2022, 12:44 PM

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

                  A 1 Reply Last reply Sep 6, 2022, 12:47 PM Reply Quote 0
                  • A
                    Alan Kilborn @Uwe Recknagel
                    last edited by Sep 6, 2022, 12:47 PM

                    @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
                    5 out of 9
                    • First post
                      5/9
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors