110,538
社区成员
发帖
与我相关
我的任务
分享
List<string> list = new List<string>() {
"123abc",
"123.123abc"
};
list = list.Select(a => {
Match m = Regex.Match(a,@"(?i)(\d+?(\.\d+)?)([a-z]+)");
return m.Groups[1].Value + " " + m.Groups[3].Value;
}).ToList();
string str = "123.123adc";
foreach (Match match in Regex.Matches(str, @"[0-9]+(\.[0-9]+)?|[a-zA-Z]+"))
Console.WriteLine(match.Value);