Community
    • Login

    How to replace a value after a statement?

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

          Thank you so much, you are a saviour

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