Community
    • Login

    Replace random values with 0

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

          @ Coises You are amazing,thank you very much.

          1 Reply Last reply Reply Quote 0

          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