using System;
using System.Text.RegularExpressions;
public class Program
{
public static void Main()
string example = "hola[esto.es.una.prueba]";
example = Regex.Replace(example, "[\\.\\[\\]]", "_");
Console.WriteLine(example);
}