title: What code is this? /^(\d{4}|\d{6})$/
body: <p>So I am extremely new to the Javascript world. I was practicing on codewars having to analyze a pin to make sure it only contained numbers and was either 4 or 6 characters. I looked at the most clever code and the answer was:</p>
  
  <pre><code>function validatePIN(pin) {
    return /^(\d{4}|\d{6})$/.test(pin)
  }
  </code></pre>
  
  <p>I've never seen the "/^(\d{4}|\d{6})$/" bit before. Could anyone tell me what this is called so I can research it on my own, or give me a breakdown of how it works?</p>