function addBrackets(match){
return '(' + match+ ')';
}
var str = 'zhllZHaa';
var reg = new RegExp('zh', 'ig');
console.log(str.replace(reg,addBrackets))//(zh)ll(ZH)aa
function addBrackets(match){
return '(' + match+ ')';
}
var str = 'zhllZHaa';
var reg = new RegExp('zh', 'ig');
console.log(str.replace(reg,addBrackets))//(zh)ll(ZH)aa