Community
    • Login

    How to replace a value after a statement?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    replacevaluestatement
    3 Posts 2 Posters 1.6k Views 2 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.
    • RathardR Offline
      Rathard
      last edited by

      I want to replace a number that comes after a statement, more specifically: factor = “number” [without the "]. Is there any way how I can replace all numbers after factor = without doing it manually? For example, I want to replace all numbers that come after factor = with 40, the numbers after factor = are completely random, is there any way how to automatically replace it?

      Scott SumnerS 1 Reply Last reply Reply Quote 0
      • Scott SumnerS Offline
        Scott Sumner @Rathard
        last edited by

        @Rathard

        Yes, you could try:

        Find what zone: (?-i)factor = \d+
        Replace with zone: factor = 40
        Search mode: Regular expression

        The (?-i) means the case of what follows is important to the match – in this case it means that factor will match but FACTOR or Factor or … will NOT match. If the case of factor doesn’t matter to you, you can use (?i) instead.

        The \d+ part means that at that location in a potentially matching string, a series of one or more digit characters must occur for the match to be “made” and consequently replaced by the replace-with text.

        1 Reply Last reply Reply Quote 1
        • RathardR Offline
          Rathard
          last edited by

          Thank you so much, you are a saviour

          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