\{([^\}]+)\}这个正则的$1就是所有内容了
var str=document.getElementById("sqlsrc").innerHTML; var par=/\{([^\}]+)\}/; if(par.test(str)) { alert(RegExp.$1); }