6*x + 7 = 7*x + 2 - 3*x
When we move the right side to the left of the equation, we need to flip the operator sign from + to - and vice versa.
Using java regex replaceAll , we can replace all + with -s. As a result, all operator signs become -'s, which makes it impossible to restore all +.
As a workaround, I repeat the line and change + to - when I run into one and vice versa. But I'm still wondering if there is a way to flip between logical pairs of values ββusing regex in Java?
source share