<script type="text/javascript">
      var str="(AAA)/(BBB)/(CCC)/[11]/[22]/[33]/{xxxx}/{yy}/{zzz}";
      
      var regex1 = /\((.+?)\)/g;   // () 小括号
      var regex2 = /\[(.+?)\]/g;   // [] 中括号
      var regex3 = /\{(.+?)\}/g;  // {} 花括号,大括号
      
      // 输出是一个数组
      console.log(str.match(regex1)); 
      console.log(str.match(regex2));
      console.log(str.match(regex3));
</script>

标签: none

评论已关闭