using System.Collections.Generic;
using System.Text.RegularExpressions;
public static void Main()
string input = "this is your sensitive digit 12345 , if you have any question please call +91999999999999 and my home number is +123 3241 432423";
Regex rgx = new Regex(@"\d{4,}\d");
string replacedstar = rgx.Replace( input, "*****", 1 );
Console.WriteLine(MaskDigits(input));
public static string MaskDigits(string input)
var split = input.Split("call");
StringBuilder sb = new StringBuilder();
Regex rgx = new Regex(@"\d{4,}\d");
string replacedstar = rgx.Replace( split[0], "*****");
return replacedstar + "call" + string.Join("", split.Skip(1).ToList());