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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -