Community
    • Login

    Help with formula

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    help with formu
    5 Posts 2 Posters 3.5k 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.
    • Joe BlowJ Offline
      Joe Blow
      last edited by

      How do i search for “log” and “quantity” then replace the numbers after it…

      …contents log quantity 76 lastaccessed 2323.00 end

      …contents log quantity 344 lastaccessed 7854.00 end

      Chane the numbers (76, 344) to say (1000) but NOT change anything else (the file has a lot of other info.

      1 Reply Last reply Reply Quote 0
      • Joe BlowJ Offline
        Joe Blow
        last edited by

        You know something like
        Log quantity +./k (?=lastaccess)
        Its something like that…but im not sure???

        Log+quantity /k(??=lastaccess)

        Does anyone know about that…or even a different way to change those amounts only…i have other amounts of other things in the file, so it must change logs only nothing else

        1 Reply Last reply Reply Quote 0
        • Joe BlowJ Offline
          Joe Blow
          last edited by

          Ok nevermind…i recalled what guy038 said about the subject and figured out what i needed thanks anyway…and if you read this guy038, thanks.

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

            Hello Joe,

            If there’s only ONE string log quantity ( or zero, of course ), in each line of your file, with only ONE space, between the two words, I think that two solutions are possible :

            SEARCH = (?<=log quantity ) *\d+ and REPLACE = 1000 with a SPACE, before and after the ending round bracket

            SEARCH = log quantity \K *\d+ and REPLACE = 1000 with a SPACE, after the word quantity and after the syntax \K

            Notes :

            • In the first regex, we look for a possible range of spaces ( *), followed by a non empty range of digits, ONLY IF it is preceded with the string "log quantity "

            • In the second regex, we, first, try to match the string "log quantity " and, due to the \K syntax, the regex engine restart the search process. So, we, finally, looks, as before, for a possible range of spaces ( *), followed by a non empty range of digits

            IMPORTANT :

            • Due to the \K syntax or the (?<=log quantity ) look-behind, this S/R does NOT work, if you click, several times, on the Replace button, for step by step replacement

            • You need to us, exclusively, the buttons Replace All or Replace All in All Opened Documents, of the Replace dialog

            Best Regards,

            guy038

            P.S. :

            If the words log and quantity may be separated by an arbitrary number of spaces, the first regex must NOT be used. Indeed, the syntax (?<=log +quantity ) *\d+ is an invalid regular expression, because the expression log +quantity is NOT a fixed length string, inside a look-behind !

            On the contrary, the regex log +quantity \K *\d+ is a correct regular expression :-))

            1 Reply Last reply Reply Quote 0
            • Joe BlowJ Offline
              Joe Blow
              last edited by

              ok I’m getting flagged as spam (not sure why) so I’m going to try to post this…

              thanks guy038
              question
              I need to add in two lines of text
              training 57
              and
              tazertrained true

              after the line:
              BodyArmour StabVest

              and before the line
              END

              do you know how to add in the two last lines
              note: they should be indented

              http://www78.zippyshare.com/v/r6Sh5S7m/file.html
              screenshot

              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