fork(5) download
  1. var string = "Hi, my account number is 1234 5678 9012 2345 and I'm great.";
  2. var new_string = string.replace(/\b[\dX][-. \dX]+(\d{4})\b/g, function(match, capture) {
  3. return Array(match.length-4).join("*") + capture;
  4. });
  5. print(new_string);
Success #stdin #stdout 0s 105920KB
stdin
Standard input is empty
stdout
Hi, my account number is **************2345 and I'm great.