using System;
using System.Text.RegularExpressions;
public class Program
{
public static void Main()
//string source = "123gd789fg";
string source = null;
var r = new Regex("[0-9]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
string res = null;
try{
res = r.Replace(source, "x");
}
catch(Exception){
res = source;
Console.WriteLine(res?.ToString());