title: How do I force user to enter specific pattern in input field using regex and javascript
body: <p>I admit, I never explored into the regex albeit knowing its power. And its striking back to me.
  I am trying to make user enter pattern P99999999 into an input text where P is mandatory while 99999999 can take any digits(not letters). I'm triggering keyup, input field has uppercasing through styling and so far, this is what I have done (I know its too little). </p>
  
  <pre><code>inpt.value = $.trim( inpt.value );
  if( inpt.value.indexOf( 'P' ) != 0 )
      inpt.value = inpt.value.replace(/[A-Z]/g, '');
  </code></pre>
  
  <p>After some exploring I come up with this</p>
  
  <pre><code>[P]+[0-9]+(?:\.[0-9]*)?
  </code></pre>
  
  <p>I do not know how to validate my input against this. This was generated by an online tool. I know it shouldn't be that hard. Any help.</p>