Bootstrap

正则匹配 --- 从某字符开始到某字符结束

通过正则匹配查找处理文本内容

    Match RegexStrTo(string str, string pattern)
    {
        Regex r = new Regex(pattern);
        Match m = r.Match(str);
        return m;
    }
    List<string> GetbundleURL(string path)
    {
        string bundleURL = "";
        List<string> bundleUrList = new List<string>();
        if (System.IO.File.Exists(path))
        {
            string scrTxt = System.IO.File.ReadAllText(path);
            //去掉单行注释
            for (int i = 0; i < 2; i++)
            {
                Match mstr = RegexStrTo(scrTxt, "(\\s//)(.*?)(\n)");//"//"开始 "\n"结束
                while (mstr.Success)
                {
                    string val = mstr.Value.ToString();
                    scrTxt = scrTxt.Replace(val, "\n");
                    mstr = mstr.NextMatch();
                }
            }
            //去掉多行注释/**/
            Match mMany = R
;