• Login
Community
  • Login

need help replacing multiple "answers" to these lines?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 3 Posters 364 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.
  • C
    Chrismatt D
    last edited by Nov 1, 2024, 8:19 AM

    Hello, im completely new to NotePad++, and i need help figuring out how to change this all at once. i dont want to sit here and do it all individually lol.

    im using a minecraft mod config file and i want to change all the, for example,
    “stamina”: 1200

    to
    “stamina”: 9999

    or,
    “speedModifier”: 1.5,

    to
    “speedModifier”: 2,

    all of the “speedModifier” tokens (I think thats what theyre called) to 2, and all the “stamina” to 9999.

    heres an example snip.
    801693cb-73c1-496d-85ca-33fd52485b01-image.png

    Help please!!

    T 1 Reply Last reply Nov 1, 2024, 8:54 AM Reply Quote 0
    • T
      Thomas Knoefel @Chrismatt D
      last edited by Thomas Knoefel Nov 1, 2024, 9:03 AM Nov 1, 2024, 8:54 AM

      @Chrismatt-D

      You have to enable “Regular expression” in Replace and you will add
      Find what: "stamina":\s*\d+
      Replace with: "stamina": 9999

      Find what: "speedModifier":\s*\d+(\.\d+)?
      Replace with: "speedModifier": 2

      You can do each replacement separately, or manage all replacements in a list using the MultiReplace plugin.

      C 1 Reply Last reply Nov 2, 2024, 3:20 AM Reply Quote 3
      • C
        Chrismatt D @Thomas Knoefel
        last edited by Nov 2, 2024, 3:20 AM

        @Thomas-Knoefel said in need help replacing multiple "answers" to these lines?:

        Find what: “speedModifier”:\s*\d+(.\d+)?

        THANK YOU SO MUCH!

        1 Reply Last reply Reply Quote 1
        • M
          Mark Olson
          last edited by Nov 2, 2024, 7:27 PM

          You might also be able to achieve this with the query

          @..stamina = 9999;
          @..speedModifier = 2
          

          in the JsonTools plugin .

          In this case a regex-based solution as described by Thomas Knoefel will work fine, but if you want more control over how you manipulate your JSON, a JSON parser like JsonTools is likely a better option.

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