/* GroupBegin General2 */ 
<!-- aaa -->table html{   这个注释也有可能是这种形式的/* asdfadf */ background-image:None;<!-- alsdkjfalsjf --> 
word-spacing:normal; <!--asdfjaksdlj-->
padding-top:50px; /*asdfasdfad*/
padding-left:50px; 

/* GroupEnd */  
/* GroupBegin test113 */ 
/*asdfasdfad*/ 这个注释也有可能是这种形式的<!-- asdfadf -->也有可能没有注释 
b p{ 
margin-top:50px; 
margin-left:50px; 
margin-right:50px; 
margin-bottom:50px; 

/* GroupEnd */
我想取到 
table html
b p
也就是stylename 保留中间的空格

解决方案 »

  1.   

    var ret = [];
    text.replace(/([^/>{}]+){/gi, function(m, $1){ ret.push($1); });
    alert(ret);
      

  2.   

    谢谢多次的帮助。方便留下qq 或 msn吗交个朋友
      

  3.   

    您好。用您的式子一直话语法有错误。帮忙看看。我应该加的不对。
    function getStyle(css) {
        if (!isEmptyOrNull(css)) return;
        var ArrayListStyle = new Array();
        if (isEmptyOrNull(css)) {
            css = css.replace(/\s*(\S+)\s*{([^}]*)}/g, function(m, $1) {
            //css = css.replace(/^([\w \#\.\-,]+)\s*{([^}]*)}/gm, function(m, $1) {
                ArrayListStyle.push($1);
                return '';
            });
        }
        else {
            return;
        }
        alert(ArrayListStyle);
        return ArrayListStyle;
    }我应该怎么修改
      

  4.   

    形式1
    /*     GroupBegin    General2*/<!--alsdkjfalsjf-->#style1  tab{background-image:None;<!-- alsdkjfalsjf -->word-spacing:normal; <!--asdfjaksdlj-->padding-top:50px; /*asdfasdfad*/padding-left:50px; } /*GroupEnd    *//*     GroupBegin    test113    *//*asdfasdfasdfasdf*/tab  tab  tab  table   .test { margin-top:50px; margin-left:50px; margin-right:50px;margin-bottom:50px; }/*GroupEnd*/GroupBegion后面的字符要提出来。标红的部分有可能有空格。也有可能没有空格
      

  5.   

    var ret = [];
    text.replace(/\/\*\s*GroupBegin\s*([^*]+)\s*\*\//g, function(m, $1){
      ret.push($1);
      return m;
    });
    alert(ret);