在C#中,我想替换所有敏感数字,并用*替换/掩码,但还有一些其他数字我不想替换,例如电话号码是一个常量.
这就是我现在正在做的事情
String original = "this is your sensitive digit 12345 , if you have any question please call CONSTANTPHONENUMBER";
String pattern = @"[0-9]{4,}";
String result = Regex.Replace(original, pattern, "****");
结果是
这是您的敏感数字*,如果您有任何问题,请致电*
我的问题是,我如何排除那个CONSTANTPHONENUMBER,这样它就不会被替换.
想要的结果
"this is your sensitive digit **** , if you have any question please call CONSTANTPHONENUMBER"个