title: Mask a portion of a String using RegExp
body: <p>I'm trying to mask a portion of a string using JavaScript.</p>
  
  <p>e.g. Mask second and third segment of credit-card number like this using regex:</p>
  
  <ul>
  <li><code>4567 6365 7987 3783</code> → <code>4567 **** **** 3783</code></li>
  <li><code>3457 732837 82372</code> → <code>3457 ****** 82372</code></li>
  </ul>
  
  <p>I just want to keep the first 4 numbers and the last 5 characters.</p>
  
  <p>This is my first attempt: <code>/(?!^.*)[^a-zA-Z\s](?=.{5})/g</code></p>
  
  <blockquote>
    <p><a href="https://regex101.com/r/ZBi54c/2" rel="noreferrer">https://regex101.com/r/ZBi54c/2</a></p>
  </blockquote>