Please tell me how I can write a regular expression such that every open- and close-parentheses has exactly one space character before and after it. If there is any other whitespace around the paren, it's collapsed into a single space character.
For instance, this code:
foo (bar ( new Point(x, graph.getY()) ));
Would be modified to look like this:
foo ( bar ( new Point ( x, graph.getY ( ) ) ) ) ;