Community
    • Login

    Replace part of an expression from a line, in many documents

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 468 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.
    • George RJG
      George RJ
      last edited by

      Hi guys, ive been using notepad++ for a few years but i never started to actually USE it. If you know what i mean lol.

      The thing is, i tried to find a guide about regular expressions but im completely lost and its everything too overwheelming.

      I have several documents, and in all of em there is a line that follows as ->

      spawn_rate : 0.05

      So, the number is the thing i want to replace. I want to search in all documents the lines with spawn_rate : xx and replace em with spawn_rate: 0.01 (a fixed number for all lines).

      Thanks in advance!.

      Meta ChuhM 1 Reply Last reply Reply Quote 0
      • Meta ChuhM
        Meta Chuh moderator @George RJ
        last edited by

        welcome to the notepad++ community, @George-RJ

        if you want to replace all digits, that match the pattern 1.23, open the replace window and enter the following:

        find what: (\d.\d\d)
        replace with: 0.01
        search mode: regular expression

        then either replace one by one, or hit replace all.

        note: if those numbers also exist on positions you don’t want to replace, and you want to explicitly replace spawn_rate entries only, please enter the following:

        find what: spawn_rate : (\d.\d\d)
        replace with: spawn_rate : 0.01
        search mode: regular expression

        ps: if regex isn’t too overwhelming in general, please have a look at this faq section on where to find some understandable regex documentation for beginners:
        https://notepad-plus-plus.org/community/topic/15765/faq-desk-where-to-find-regex-documentation

        best regards.

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