I want to replace some spaces between some parenthesis with regex. If I use regex only replace some spaces (only unique pairs).
The string may be have others spaces, but I want only the spaces between paranthesis.
var mystring = ") ) ) ) ) )";
console.log(mystring);
mystring = mystring.replace(/\)\s\)/g, "))");
console.log(mystring);
Output is:
) ) ) ) ) )
)) )) ))
But I want to have this output:
) ) ) ) ) )
))))))