str="sasa:121sajkj,12asa";
str2="sasa:12:12:12:12sas,121sa";
MatchCollection m = Regex.Matches(str, "[0-9]", RegexOptions.IgnoreCase);
这样写会取出所有的数字
我想取出冒号后面的数字,应该怎么写
strNum=121;
strNum2=12121212;
str2="sasa:12:12:12:12sas,121sa";
MatchCollection m = Regex.Matches(str, "[0-9]", RegexOptions.IgnoreCase);
这样写会取出所有的数字
我想取出冒号后面的数字,应该怎么写
strNum=121;
strNum2=12121212;
foreach (Match m in Regex.Matches(str, @"(?s)[^>]*:(?<title>\d+)[^>]*,"))
{
Console.WriteLine(m.Groups["title"].Value);
}
strNum2 = Regex.Match(str2, "(:\d+)+").Value.Replace(":","");