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).
inpt.value = $.trim( inpt.value );
if( inpt.value.indexOf( 'P' ) != 0 )
inpt.value = inpt.value.replace(/[A-Z]/g, '');
After some exploring I come up with this
[P]+[0-9]+(?:\.[0-9]*)?
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.