title: Regex exact length of whole string
body: <p>I want to match a string of exact 3 length. I am using the following regex </p>
  
  <pre><code>("\\d?[A-Za-z]{2,3}\d?")
  </code></pre>
  
  <p>Here the string can have 1 digit either at start or at end of the string, or the string can have 3 letters.Is there any way to define length of the matching string like :</p>
  
  <pre><code>("(\\d?[A-Za-z]{2,3}\d?){3}") // it does not work
  </code></pre>
  
  <p>I have another solution of it.</p>
  
  <pre><code>("(\\d[A-Za-z]{2})|([A-Za-z]{2}\\d)|([A-Za-z]{3})")
  </code></pre>
  
  <p>But I just want to know if there is any way to define length of whole matching string.</p>