Multiply value

  • Hello
    On notepad i want to muliply value in all files in folder
    On all file, i have label Size1 = 20,40 and Size2 = 30,60
    And i want to replace with this news value sizes = 40,80 Size2 = 60,120 but in all file.

    Which syntaxt should i set in fonction search and replace


  • regular expressions in search-and-replace are powerful, but they don’t have built-in arbitrary math expressions.

    If all you wanted to do was replace all instances of Size1 = 20,40 with Size1 = 40,80, that would be easy. If you just had the two sizes, you could use some alternating expressions in the regex replace to make sure the right source got replaced with the right replacement in all the files. But if you have an arbitrary number of SizeN = XXX,YYY, where N, XXX, and YYY all have many values, then crafting a regexp to do that would be an exercise in futility, because you’d have to provide all possible combinations (and you’d miss one)

    You need a programming language, where you would then have to extract the data from each line of your file, do the math, and write to a new file (or use in-place editing features of your language of choice).

    You could write that code in Notepad++. If you use PythonScript or LuaScript plugins, you could even run that code on files that are open in Notepad++. But it really is not a task specific to Notepad++, and the problem is not something that Notepad++ can solve for you.

Log in to reply