110,536
社区成员
发帖
与我相关
我的任务
分享
string abc ="AAA[ccccc]" //AAA不是固定的字符
void Main()
{
string s =@"AAA[ccccc]";
foreach (Match m in Regex.Matches(s, @"(?<=\[).*?[^\]](?=\])"))
{
Console.WriteLine(m.Value);
}
}
//ccccc
void Main()
{
string s =@"AAA[ccccc]";
foreach (Match m in Regex.Matches(s, @"(?<=\[).*(?=\])"))
{
Console.WriteLine(m.Value);
}
}
//ccccc
(?<=\[)[^]]+(?=\])