I have a text field it should allow only Number, only one time 'Q' and 'C'. I created below mentioned code. 

         <input type="text" name="vcno" onkeypress="return blockChars([^0-9-Qq-Cc])">

          function blockChars(Chars){
                   var status = false;       
                   if(Chars.indexOf('\\') != -1)
                   varKeyCode = getKeyCode() ;
                   if(KeyCode != undefined && isEmptyValue(Chars) ){
                        var g = String.fromCharCode(KeyCode);
                               return false;
                       else if(g == '+')
                               return false;
                       else if(status && g == '\\')
                               return false;
                               return true;
From this code, my text field allows many No. of times 'Q' and 'C'. Is any regular expression available for my fullfill condition? 

So, if I understand right, you want to allow and number of numeric characters but 'Q' or 'C' should only appear once.


However I have some questions:
1. Is the Q or C mandatory or optional
2. Is it one Q and one C
3. Are numeric characters mandatory or optional

Thanks for your reply Stbuchok. 
       1.  It is one Q and one C
       2.  Numeric characters or Q and C
 I have some modification in my previous question. I should allow first Q or Numeric characters.

If I type Q first then I should not allow to type Numeric characters.  I should allow typing only C. Q and C appears only one time.  

If I type Numeric characters first then I should not allow to type Q and C.