Help with JavaScript Regex
I need help with a R开发者_Go百科egex expression to valid an ID pattern which is 7 characters where the first position is Alpha (A-Z) and ignore case and last 6 is Numeric (0-9).
Example: X155230 or x155230
Thanks guys.
This should work:
/^[a-z]\d{6}$/i
You could at least do some basic research in the javascript documentation. The pattern you need is
/^[A-Za-z]\d{6}$/
This seems to find your pattern, RegExr, you just have to put it into JavaScript.
The actual Regex /^[a-zA-Z]\d{6}/i
It's quite simple:
/^[A-Z]{1}[0-9]{6}$/i
精彩评论