using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
public static void Main()
var cc = new List<string>()
{ "5610-5910-8101-8250"},
{ "6011-1111-1111-1117"},
{ "6011-0009-9013-9424"},
{ "3530-1113-3330-0000"},
{ "3566-0020-2036-0505"},
{ "5555-5555-5555-4444"},
{ "5105-1051-0510-5100"},
{ "4111-1111-1111-1111"},
{ "4012-8888-8888-1881"},
{ "5019-7170-1010-3742"},
{ "6331-1019-9999-0016"},
{ "my number is3782-822463-10005"},
{ "hi my number is 3714-496353-98431"},
{ "3787-344936-71000 is my number"},
{ "5610-5910-8101-8250is my number"},
Regex findSpecialChars = new Regex(@"[●-]");
Regex ccRegs = new Regex(@"^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$");
string resultString = "";
var reg = new Regex(@"(?<=\d{4}\d{2})\d{2}\d{4}(?=\d{4})|(?<=\d{4}( |-)\d{2})\d{2}\1\d{4}(?=\1\d{4})");
resultString = findSpecialChars.Replace(x,"");
resultString = ccRegs.Replace(resultString, "****-****-****-****");
Console.WriteLine(resultString);