Skip to content

Commit 9b266f5

Browse files
authored
Merge pull request #27 from othmanalikhan-security/master
Added a Regex Definition for Saudi Arabian Passports
2 parents d2f9627 + 6b415b6 commit 9b266f5

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

definitions.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@
141141
"<<<<"
142142
]
143143
},
144+
"Saudi Arabian Passport": {
145+
"regex":"(?:P<SAU)(?:[A-Z0-9<].+)",
146+
"region":"Saudi Arabia",
147+
"keywords":[
148+
"Passport",
149+
"Saudi Arabia",
150+
"SAU",
151+
"<<<<"
152+
]
153+
},
144154
"Nebraska Driver's License": {
145155
"regex":"[A-Z]{1}[0-9]{9,11}",
146156
"region":"United States",

text_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def string_tokenizer(text):
3939
def similarity(a, b): return difflib.SequenceMatcher(None, a, b).ratio() * 100
4040

4141
def get_regexes():
42-
with open('definitions.json') as json_file:
42+
with open('definitions.json', "r", encoding='utf-8') as json_file:
4343
_rules = json.load(json_file)
4444
return _rules
4545

@@ -133,4 +133,4 @@ def keywords_classify_pii(rules, intelligible_text_list):
133133
) > 80: scores[key] += 1
134134

135135
return scores
136-
136+

0 commit comments

Comments
 (0)