vue 正则匹配group组

//var ruleExpPattern= /( && )?(!)?(IN)?\((?<groupname>[a-zA-Z]+),'(?<groupvalue>(\w+,?)+)'\)/
 
    var ruleExpPattern= /\((?<groupname>[a-zA-Z]+),'(?<groupvalue>(\w+,?)+)'\)/g let matchresult=null

      let str='IN(TRANSMD,'2') && IN(INSROLE,'R') && IN(RCVINSCD,'00001344')'
      while ((matchresult=ruleExpPattern.exec(str))!=null) {


        str=str.replace(matchresult[0],"")

           console.log(matchresult.groups["groupname"],matchresult.groups["groupvalue"])

        }

 

posted @ 2023-02-24 16:28  ☆♂安♀★  阅读(66)  评论(0编辑  收藏  举报