Skip to content

Commit 6cf1b79

Browse files
authored
Merge pull request #2 from benjaminlhai/fix/sg_passport_regex
added sg passport regex and tests
2 parents daccce9 + 004a944 commit 6cf1b79

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

pyvalidator/is_passport_number.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"RS": r"^\d{9}$", # SERBIA,
5050
"RU": r"^\d{9}$", # RUSSIAN FEDERATION
5151
"SE": r"^\d{8}$", # SWEDEN
52+
"SG": r"^(e|E)\d{7}[a-zA-Z]{1}$", # SINGAPORE
5253
"SL": r"^(P)[A-Z]\d{7}$", # SLOVENIA
5354
"SK": r"^[0-9A-Z]\d{7}$", # SLOVAKIA
5455
"TR": r"^[A-Z]\d{8}$", # TURKEY

test/test_is_passport_number.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ def test_valid_passport_number(self):
8686
['2 32 636829', "RU"],
8787
['012 345321', "RU"],
8888
['59000001', "SE"],
89+
['E1234567S', "SG"],
90+
['e9999991Q', "SG"],
8991
['PB0036440', "SL"],
9092
['P0000000', "SK"],
9193
['U 06764100', "TR"],
@@ -164,6 +166,8 @@ def test_invalid_passport_number(self):
164166
['01A 3D5321', "RU"],
165167
['A 2R YU46J0', "RU"],
166168
['SE012345', "SE"],
169+
['S1234567E', "SG"],
170+
['E99999911', "SG"],
167171
['SL0123456', "SL"],
168172
['SK012345', "SK"],
169173
['06764100U', "TR"],

0 commit comments

Comments
 (0)