Validate certain string using RegEx
I need to validate following string using Regular Expressions. These are the constraints which apply for this string.
- From beggining it has 9 numbers.
- In the end it has character 'V' or 'X'. They can be simple or capital.
- Whole length of string must be 10.
Ex: 84256142V, 547812375X
Can anyone provide me RegEx for validat开发者_如何学运维e this.
^\d{9}[VX]$
if you put the regex engine in case-insensitive mode, ^\d{9}[vVxX]$
otherwise.
Depends on the language, but it will be something like this:
^[0-9]{9}[VvXx]$
This is the Regex you need: /^(\d){9}(V|X)$/i
精彩评论