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"])

        }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章