Replace random values with 0
-
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 thisenv_factor : { 0 , 0 , 0 }
An exampleenv_factor : { 0.5215321 , 0.11243 , 0.94 } to replace with
env_factor : { 0 , 0 , 0 }Thank you. -
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*\} -
@ Coises You are amazing,thank you very much.
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