title: Regex to validate alphanumeric, underscores and hyphens with no spaces and only 40 characters
body: <p>I wanted to know how I can specify character count for my regex. 
  I have the correct regex, I only need to make sure this will work validating zero to fourty characters.</p>
  
  <p>here is the regex</p>
  
  <p><code>$fnameRegex = "/^[a-zA-Z0-9{0,40}-_]+$/";</code></p>
  
  <p>i might have put the <code>{0,40}</code> in the wrong place. </p>