求一正则表达式?
string str="[sdfsdfsdf][esdf][ddddd][efsdfe][ssss][fds][123sdf]";
如何提取中括号里的字符串到一个字符串数组
------解决方案--------------------
Regex.Matches(str, @"(?<=\[)[^\[\]]*?(?=\])").Cast<Match>().Select(m => m.Value).ToArray()
------解决方案--------------------
System.Collections.Generic.List<string> stringarray = new System.Collections.Generic.List<string>();
string str = "[sdfsdfsdf][esdf][ddddd][efsdfe][ssss][fds][123sdf]";
var matches = Regex.Matches(str, @"(?<=\[)[^]]+(?=\])");
foreach (Match m in matches)
{
stringarray.Add(m.Value);
}