0

I'm trying to recalculate numbers in a file and replace them with new values. For example;

value=50
value=60
value=70
value=80
value=90
value=100
value=110

in file, I have some numbers and I want them divide by 2 and replace with new values.

I can find the numbers (\d+)$ and I can't use math operators when replace like $1 / 2 or ($1 / 2) How I can replace their values with math applied values?

after replacement done, values should look like that

value=25
value=30
value=35
value=40
value=45
value=50
value=55
Ramazan
  • 79
  • 3
  • 13
  • 1
    You can't easily do this in Notepad++ using regex alone, AFAIK. But, this would be easy to handle using a programming language. Do you have any other options besides Notepad++? – Tim Biegeleisen Oct 03 '18 at 07:08
  • 1
    You may do it in NPP using a PythonScript script. It is rather straightforward there since you are using Python then. Probably, using Python itself would make more sense. Or any other full-fledged language. – Wiktor Stribiżew Oct 03 '18 at 07:10
  • Hi Tim, I can do it easily in C# but, notepad++ functions and colors and readability is much more better. So, I am analyzing file first then replacing values. It is why I'm trying with notepad++ – Ramazan Oct 03 '18 at 07:11
  • 1
    I vote for doing this in C# then. – Tim Biegeleisen Oct 03 '18 at 07:12
  • Hi Wiktor, I never seen a script can be usable in notepad++, I'll research for it. Thank you – Ramazan Oct 03 '18 at 07:12
  • 1
    You may see my previous related answers, [this one](https://stackoverflow.com/questions/37300462/notepad-find-replace-number-with-increment-value/37300757#37300757) will surely help. Probably, we may even close this question as a dupe, there is everything you need to solve this current issue. – Wiktor Stribiżew Oct 03 '18 at 07:15
  • 3
    Possible duplicate of [Notepad++ Find/Replace number with Increment Value](https://stackoverflow.com/questions/37300462/notepad-find-replace-number-with-increment-value) – Wiktor Stribiżew Oct 03 '18 at 07:28

0 Answers0