만약에
Now is the time for all good people to come to the aid of the party
라는 문장이 있다면,
정확히 4글자인 단어를 아래와 같이 ****로 치환하고 싶습니다.
=> Now is the **** for all **** people to **** to the aid of the party
var sentence = Console.ReadLine();
var test = Regex.Replace(sentence, @"[a-zA-Z]{4}", "****");
Console.WriteLine(test);
위의 코드로는
=> Now is the **** for all **** ****le to **** to the aid of the ****y
이렇게 나옵니다.