regex - C# replace part of the message -


string message = "your purchase of $ 100.00 awaiting confirmation. please use pin 8967 complete transaction. reference number :1237689";  string output = regex.replace(message, @"[\d-]", "*");  console.writeline("message : " + message);  console.writeline("output : " + output);  console.readline(); 

i want replace pin of message. above message replace numeric values * characters.

string message = "your purchase of $ 100.00 awaiting confirmation. please use pin 8967 complete transaction. reference number :1237689"; string output = regex.replace(message, @"(?<=pin\s*\d*)\d", "*"); 

or

string message = "your purchase of $ 100.00 awaiting confirmation. please use pin 8967 complete transaction. reference number :1237689"; string output = regex.replace(message, @"(?<=pin\s*)\d+", m => new string('*', m.length)); 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -