1、提取大括号里面的内容 var reg = /[^\{}]*\{(.*)\}[^\}]*/; var str = "8324{aab}"; console.log("大括号的内容为:",str.replace(reg,'$1'));//输出aab 2、提取字符串里的手机号码 checkPhone(text) { const phoneList=text.match(/((((13[0-9])|(15[^4])|(18[0,1,2,3,5-9])|(17[0-8])|(16[0-9])|(147))\d{8})|((\d3,4|\d{3,4}-|\s)?\d{7,14}))?/g); const phone =phoneList.filter(item=>{ return item!='' }) return phone; }, 3、提取以字母开头后面全部是数组的字符串 var a = '礼品6款入c02806015123'; var pattern = /([A-Za-z]{1}[0-9]*)/g; //以字母开头,后面全部都是数字的字符串 const result = pattern.exec(a)[0] console.log("提取的结果为:", result)//输出:c02806015123