Remove text between two parenthesis, if two more parenthesis [closed]

You can use String.replace() with regex like this https://regex101.com/r/X7ioxu/1

var regex = /(\(.+?\))\s?\(/g;
var str1 = "This thing (123, 12) (2005.03 - 2011.12)";
var str1 = "This thing (2005.03 - 2011.12)";

alert(str1.replace(regex,'('));
alert(str2.replace(regex,'('));

Leave a Comment