Community
    • Login

    Replace random values with 0

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 290 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.
    • Raoul EmilR
      Raoul Emil
      last edited by Raoul Emil

      Hello. I want to search for this (in Notepad++)
      

      env_factor : { x , y , z }

           Where x,y,z are random values/numbers
           And replace with this
      

      env_factor : { 0 , 0 , 0 }

           An example
      

      env_factor : { 0.5215321 , 0.11243 , 0.94 } to replace with
      env_factor : { 0 , 0 , 0 }

           Thank you.
      
      CoisesC 1 Reply Last reply Reply Quote 0
      • CoisesC
        Coises @Raoul Emil
        last edited by Coises

        @Raoul-Emil

        From the main menu, select Search | Replace… and fill in:

        Find what: env_factor\s*:\s*\{\s*\d+(\.\d*)?\s*,\s*\d+(\.\d*)?\s*,\s*\d+(\.\d*)?\s*\}

        Replace with: env_factor : { 0 , 0 , 0 }

        Be sure the radio button Regular expression is selected and use the Replace All button.

        This does not take into account numbers that might have minus signs or that might begin with a decimal point, without the leading zero. If you have numbers like that, replace the parts in the search like this:

        \d+(\.\d*)?

        with:

        -?(\d+(\.\d*)?|\.\d+)

        to get:

        env_factor\s*:\s*\{\s*-?(\d+(\.\d*)?|\.\d+)\s*,\s*-?(\d+(\.\d*)?|\.\d+)\s*,\s*-?(\d+(\.\d*)?|\.\d+)\s*\}

        Raoul EmilR 1 Reply Last reply Reply Quote 4
        • Raoul EmilR
          Raoul Emil @Coises
          last edited by

          @ Coises You are amazing,thank you very much.

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