Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.5k views
in Technique[技术] by (71.8m points)

js 正则校验车架号VIN

正则要求:

  1. 由大写字母和数字组成,长度17位;
  2. 字母不会出现O、Q、I三个字母;
  3. 第9位只能是【0-9】的数字和字母X;
  4. 第13-17位只能是数字;

根据百度、谷歌只搜搜到这个,还请各位大佬们赐教
现在只实现了1,2两个条件;如下:
let reg=/^[A-HJ-NPR-Zd]{17}$/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

根据规则一个个罗列出来不就是了?/^[A-HJ-NPR-Zd]{8}[Xd][A-HJ-NPR-Zd]{3}d{5}$/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...