C# 正規表示式提取字串中括號裡的值

精彩一生發表於2018-10-22
version = Regex.Replace(str, @"(.*()(.*)().*)", "$2"); //小括號()
    
Regex rgx = new Regex(@"(?i)(?<=[)(.*)(?=])");//中括號[]
string tmp = rgx.Match(CvoName).Value;//中括號[]
    
string sheetData = Regex.Match(LinkData, @"{(.*)}", RegexOptions.Singleline).Groups[1].Value;//大括號{}

 

相關文章