Make value inside line negative and viseversa

A place to try and solve your RegEx problems.
Post Reply
XJAC
Posts: 4
Joined: Fri Sep 14, 2018 3:28 pm

Make value inside line negative and viseversa

Post by XJAC »

Hi,

I need some help from someone with more experience than me concerning the regular expressions

I have text files that are automaticaly generated in another software, and want to change the value inside it from negative to positive and viseversa.

The example:
Search is always the same: Find the second decimal value in this line, so 'SetSuctionCupPosition(X,' is always in the beginning. Then I want the value -100 to become 100; The part after the second comma stays the same.
So Search =

Code: Select all

SetSuctionCupPosition(3,-100,0,"H75-M-145x145");
Replaced result =

Code: Select all

SetSuctionCupPosition(3,100,0,"H75-M-145x145");
And the opposite:
Search =

Code: Select all

SetSuctionCupPosition(3,100,0,"H75-M-145x145");
Replaced result =

Code: Select all

SetSuctionCupPosition(3,-100,0,"H75-M-145x145");
Can somebody provide the search replace expression to obtain this?

Many thanks in advance!!
Post Reply