开发者

Validate certain string using RegEx

I need to validate following string using Regular Expressions. These are the constraints which apply for this string.

  1. From beggining it has 9 numbers.
  2. In the end it has character 'V' or 'X'. They can be simple or capital.
  3. 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜