string message = "Your purchase of $ 100.00 is awaiting for confirmation. Please use PIN 8967 to complete the transaction. Reference Number :1237689";
string output = Regex.Replace(message, @"[\d-]", "*");
Console.WriteLine("Message : " + message);
Console.WriteLine("Output : " + output);
Console.ReadLine();
我想只替换邮件的PIN。但是上面的消息会替换*字符中的所有数值。
答案 0 :(得分:3)
mysql --user=root --password=`cat /root/.mysql`
或
string message = "Your purchase of $ 100.00 is awaiting for confirmation. Please use PIN 8967 to complete the transaction. Reference Number :1237689";
string output = Regex.Replace(message, @"(?<=PIN\s*\d*)\d", "*");