Community
    • Login

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

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 641 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.
    • George RJG Offline
      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 Offline
        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

        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