• Login
Community
  • Login

Help with formula

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
help with formu
5 Posts 2 Posters 3.2k 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.
  • J
    Joe Blow
    last edited by Jul 15, 2016, 3:54 AM

    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
    • J
      Joe Blow
      last edited by Jul 15, 2016, 4:37 AM

      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
      • J
        Joe Blow
        last edited by Jul 15, 2016, 5:16 AM

        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
        • G
          guy038
          last edited by Jul 16, 2016, 10:37 AM

          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
          • J
            Joe Blow
            last edited by Jul 19, 2016, 6:40 AM

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