title: PHP preg_match - only allow alphanumeric strings and - _ characters
body: <p>I need the regex to check if a string only contains numbers, letters, hyphens or underscore</p>
  
  <pre><code>$string1 = "This is a string*";
  $string2 = "this_is-a-string";
  
  if(preg_match('******', $string1){
     echo "String 1 not acceptable acceptable";
     // String2 acceptable
  }
  </code></pre>