Navigation

    Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to replace a value after a statement?

    Help wanted · · · – – – · · ·
    replace value statement
    2
    3
    1011
    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.
    • Rathard
      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 Sumner 1 Reply Last reply Reply Quote 0
      • Scott Sumner
        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
        • Rathard
          Rathard last edited by

          Thank you so much, you are a saviour

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          Copyright © 2014 NodeBB Forums | Contributors