title: Matching Special character '-' using Regular expression in Javascript
body: <p>I have a string <code>p9909abc0221-</code> and <code>p9909abc0221</code> I have written regular expression to match the user input and validating it .The String may or may not contain '-' spcial character in last .</p>
  
  <p>Using the below code </p>
  
  <pre><code>return (str !== undefined &amp;&amp; str.match('^(P|p)[0-9]{4}(ABC|abc)[0-9]{4}[/-]$'));
  </code></pre>
  
  <p>I think I am doing wrong for '-' special character . Any help would be great</p>