62,271
社区成员
发帖
与我相关
我的任务
分享
string str = "192.168.0.226";
str = str.Substring(0, str.Length - 3);//将字符串后3位减掉
str += "*";//添加*号
string str = "192.168.0.226";
Regex reg = new Regex(@"(?<=\.)\d+(?![\d.])");
string res = reg.Replace(str, "*");
Console.WriteLine(res);
Regex re = new Regex(@"(?<=\.)\d+$", RegexOptions.None);
MatchCollection mc = re.Matches("text");
foreach (Match ma in mc)
{
}