Looking for a way to conceal part of a string using JavaScript?
For example, wanting to mask the second and third segments of a credit card number like this using regex:
4567 6365 7987 3783
→4567 **** **** 3783
3457 732837 82372
→3457 ****** 82372
The goal is to retain only the first 4 digits and the last 5 characters.
Here's what I've tried so far: /(?!^.*)[^a-zA-Z\s](?=.{5})/g