// The middle 4 of the hidden phone number is: '18812345678'.replace(/(\d{3})(\d{4})/, '$1****') Result: 188****5678 // The 4 at the end of the hidden phone number is: '18812345678'.replace(/(\d{4})$/, '****') Result: 1881234****
// The middle 4 of the hidden phone number is: '18812345678'.replace(/(\d{3})(\d{4})/, '$1****') Result: 188****5678 // The 4 at the end of the hidden phone number is: '18812345678'.replace(/(\d{4})$/, '****') Result: 1881234****