Gor*_*son 84
加拿大邮政编码不能包含字母D,F,I,O,Q或U,也不能以W或Z开头:
[ABCEGHJKLMNPRSTVXY][0-9][ABCEGHJKLMNPRSTVWXYZ][0-9][ABCEGHJKLMNPRSTVWXYZ][0-9]
Run Code Online (Sandbox Code Playgroud)
如果你想在中间有一个可选空间:
[ABCEGHJKLMNPRSTVXY][0-9][ABCEGHJKLMNPRSTVWXYZ] ?[0-9][ABCEGHJKLMNPRSTVWXYZ][0-9]
Run Code Online (Sandbox Code Playgroud)
小智 5
以下是规则http://en.wikipedia.org/wiki/Postal_code#Reserved_characters
ABCEGHJKLMNPRSTVXY <-- letter used
DFIOQU <-- letters not used because it mixes up the reader
WZ <-- letters used but not in the first letter
With that in mind the following in the proper regex
@[ABCEGHJKLMNPRSTVXY][0-9][ABCEGHJKLMNPRSTVWXYZ][\s][0-9][ABCEGHJKLMNPRSTVWXYZ][0-9]
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
45543 次 |
最近记录: |