@doccloak/core 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +230 -0
- package/dist/doc.d.ts +13 -0
- package/dist/doc.js +683 -0
- package/dist/docx.d.ts +31 -0
- package/dist/docx.js +26 -0
- package/dist/dom/docx.d.ts +90 -0
- package/dist/dom/docx.js +472 -0
- package/dist/dom/index.d.ts +11 -0
- package/dist/dom/index.js +11 -0
- package/dist/dom/ocr.d.ts +112 -0
- package/dist/dom/ocr.js +224 -0
- package/dist/engine.d.ts +81 -0
- package/dist/engine.js +274 -0
- package/dist/env.d.ts +49 -0
- package/dist/env.js +53 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +29 -0
- package/dist/model-loader.d.ts +55 -0
- package/dist/model-loader.js +253 -0
- package/dist/pipeline.d.ts +19 -0
- package/dist/pipeline.js +128 -0
- package/dist/providers/bardsai.d.ts +38 -0
- package/dist/providers/bardsai.js +393 -0
- package/dist/providers/gliner.d.ts +52 -0
- package/dist/providers/gliner.js +360 -0
- package/dist/regex/index.d.ts +17 -0
- package/dist/regex/index.js +18 -0
- package/dist/regex/loader.d.ts +44 -0
- package/dist/regex/loader.js +44 -0
- package/dist/regex/rules.data.d.ts +2 -0
- package/dist/regex/rules.data.js +2671 -0
- package/dist/regex/types.d.ts +27 -0
- package/dist/regex/types.js +1 -0
- package/dist/regex/validators.d.ts +17 -0
- package/dist/regex/validators.js +492 -0
- package/dist/session.d.ts +59 -0
- package/dist/session.js +153 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.js +28 -0
- package/dist/worker-protocol.d.ts +119 -0
- package/dist/worker-protocol.js +285 -0
- package/package.json +75 -0
- package/rules/at.json +70 -0
- package/rules/be.json +70 -0
- package/rules/ch.json +66 -0
- package/rules/cn.json +155 -0
- package/rules/de.json +192 -0
- package/rules/dk.json +43 -0
- package/rules/es.json +158 -0
- package/rules/fi.json +43 -0
- package/rules/fr.json +178 -0
- package/rules/gb.json +194 -0
- package/rules/ie.json +48 -0
- package/rules/it.json +116 -0
- package/rules/jp.json +136 -0
- package/rules/nl.json +99 -0
- package/rules/no.json +132 -0
- package/rules/pl.json +210 -0
- package/rules/pt.json +113 -0
- package/rules/schema.json +91 -0
- package/rules/se.json +149 -0
- package/rules/universal.json +279 -0
- package/rules/us.json +218 -0
package/rules/pt.json
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
{
|
|
2
|
+
"region": "pt",
|
|
3
|
+
"rules": [
|
|
4
|
+
{
|
|
5
|
+
"id": "regex:pt:cc",
|
|
6
|
+
"entityType": "SSN",
|
|
7
|
+
"pattern": "\\b\\d{9}\\s?[A-Z]{2}\\d\\b",
|
|
8
|
+
"flags": "gi",
|
|
9
|
+
"confidence": 0.85,
|
|
10
|
+
"domains": [
|
|
11
|
+
"identity"
|
|
12
|
+
],
|
|
13
|
+
"description": "Portuguese Cartão de Cidadão number (citizen card)",
|
|
14
|
+
"examples": [
|
|
15
|
+
"123456789 ZZ1"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "regex:pt:nif",
|
|
20
|
+
"entityType": "SSN",
|
|
21
|
+
"pattern": "\\b\\d{9}\\b",
|
|
22
|
+
"flags": "g",
|
|
23
|
+
"confidence": 0.8,
|
|
24
|
+
"domains": [
|
|
25
|
+
"financial",
|
|
26
|
+
"identity"
|
|
27
|
+
],
|
|
28
|
+
"description": "Portuguese NIF tax number (9 digits)",
|
|
29
|
+
"examples": [
|
|
30
|
+
"123456789"
|
|
31
|
+
],
|
|
32
|
+
"falsePositiveNotes": "9 digits is very broad",
|
|
33
|
+
"validate": "nif"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": "regex:pt:phone",
|
|
37
|
+
"entityType": "PHONE",
|
|
38
|
+
"pattern": "\\b(?:\\+?351[\\s-]?)?\\d{3}[\\s-]?\\d{3}[\\s-]?\\d{3}\\b",
|
|
39
|
+
"flags": "g",
|
|
40
|
+
"confidence": 0.8,
|
|
41
|
+
"domains": [
|
|
42
|
+
"contact"
|
|
43
|
+
],
|
|
44
|
+
"description": "Portuguese phone number (9 digits, optionally with +351)",
|
|
45
|
+
"examples": [
|
|
46
|
+
"+351 912 345 678",
|
|
47
|
+
"912-345-678"
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "regex:pt:postal",
|
|
52
|
+
"entityType": "ADDRESS",
|
|
53
|
+
"pattern": "\\b\\d{4}-\\d{3}\\s+[\\p{L}][\\p{L}\\s'-]+\\b",
|
|
54
|
+
"flags": "gu",
|
|
55
|
+
"confidence": 0.85,
|
|
56
|
+
"domains": [
|
|
57
|
+
"contact"
|
|
58
|
+
],
|
|
59
|
+
"description": "Portuguese postal code (XXXX-XXX) followed by city name",
|
|
60
|
+
"examples": [
|
|
61
|
+
"1000-001 Lisboa",
|
|
62
|
+
"4000-322 Porto"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "regex:pt:currency_words",
|
|
67
|
+
"entityType": "CURRENCY",
|
|
68
|
+
"pattern": "(?:(?:por\\s+)?extenso\\s*:\\s*|(?:a\\s+)?(?:quantia|importância|soma)\\s+de\\s+)[\\p{L}\\s-]+(?:euros?|cêntimos?|reais|centavos?)\\b",
|
|
69
|
+
"flags": "giu",
|
|
70
|
+
"confidence": 0.9,
|
|
71
|
+
"domains": [
|
|
72
|
+
"financial"
|
|
73
|
+
],
|
|
74
|
+
"description": "Portuguese amount written in words (e.g., \"por extenso: oito mil e quinhentos euros\")",
|
|
75
|
+
"examples": [
|
|
76
|
+
"por extenso: oito mil e quinhentos euros"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "regex:pt:street",
|
|
81
|
+
"entityType": "ADDRESS",
|
|
82
|
+
"pattern": "(?:(?:Rua|R\\.|Avenida|Av\\.|Praça|Pç\\.|Travessa|Tv\\.|Largo|Lg\\.|Alameda|Al\\.|Estrada|Est\\.)\\s+)[\\p{L}][\\p{L}\\s'-]+(?:,?\\s*(?:n\\.?º?\\s*)?\\d+)?",
|
|
83
|
+
"flags": "giu",
|
|
84
|
+
"confidence": 0.85,
|
|
85
|
+
"domains": [
|
|
86
|
+
"contact"
|
|
87
|
+
],
|
|
88
|
+
"description": "Portuguese street address (Rua/Avenida/Praça + name + optional number)",
|
|
89
|
+
"examples": [
|
|
90
|
+
"Rua Augusta 42",
|
|
91
|
+
"Av. da Liberdade 10",
|
|
92
|
+
"Praça do Comércio"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "regex:pt:company",
|
|
97
|
+
"entityType": "COMPANY",
|
|
98
|
+
"pattern": "[\\p{L}][\\p{L}\\s&.']+(?:\\s+)?(?:Lda\\.?|S\\.A\\.?|SGPS)\\b",
|
|
99
|
+
"flags": "gu",
|
|
100
|
+
"confidence": 0.9,
|
|
101
|
+
"domains": [
|
|
102
|
+
"legal",
|
|
103
|
+
"financial"
|
|
104
|
+
],
|
|
105
|
+
"description": "Portuguese company name with legal form (Lda., S.A., SGPS)",
|
|
106
|
+
"examples": [
|
|
107
|
+
"Galp Energia S.A.",
|
|
108
|
+
"Construções Silva Lda.",
|
|
109
|
+
"EDP SGPS"
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/WLojek/DocCloak.Core/rules/schema.json",
|
|
4
|
+
"title": "DocCloak shared regex rule pack",
|
|
5
|
+
"description": "Canonical cross-runtime rule format (architecture doc section 6). One file per region plus universal.json. Patterns are restricted to the ECMAScript/Python common subset; flags live in the flags field (no inline flags); validate is a name resolved against the per-runtime validator registry (validators.ts / validators.py).",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["region", "rules"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"region": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"pattern": "^(universal|[a-z]{2})$"
|
|
13
|
+
},
|
|
14
|
+
"rules": {
|
|
15
|
+
"type": "array",
|
|
16
|
+
"minItems": 1,
|
|
17
|
+
"items": { "$ref": "#/$defs/rule" }
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"$defs": {
|
|
21
|
+
"rule": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"additionalProperties": false,
|
|
24
|
+
"required": ["id", "entityType", "pattern", "flags", "confidence", "domains", "description"],
|
|
25
|
+
"properties": {
|
|
26
|
+
"id": {
|
|
27
|
+
"description": "Stable detector identifier, e.g. regex:pl:pesel",
|
|
28
|
+
"type": "string",
|
|
29
|
+
"pattern": "^regex:(universal|[a-z]{2}):[a-z0-9_-]+$"
|
|
30
|
+
},
|
|
31
|
+
"entityType": {
|
|
32
|
+
"enum": [
|
|
33
|
+
"PERSON",
|
|
34
|
+
"EMAIL",
|
|
35
|
+
"PHONE",
|
|
36
|
+
"SSN",
|
|
37
|
+
"CREDIT_CARD",
|
|
38
|
+
"DATE",
|
|
39
|
+
"CURRENCY",
|
|
40
|
+
"IP_ADDRESS",
|
|
41
|
+
"IBAN",
|
|
42
|
+
"ADDRESS",
|
|
43
|
+
"COMPANY",
|
|
44
|
+
"OTHER"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"pattern": {
|
|
48
|
+
"description": "Regex source in the ECMAScript/Python common subset (compiled per runtime)",
|
|
49
|
+
"type": "string",
|
|
50
|
+
"minLength": 1
|
|
51
|
+
},
|
|
52
|
+
"flags": {
|
|
53
|
+
"description": "Regex flags; the g flag is mandatory, inline flags in the pattern are forbidden",
|
|
54
|
+
"type": "string",
|
|
55
|
+
"pattern": "^g[imsuy]*$"
|
|
56
|
+
},
|
|
57
|
+
"confidence": {
|
|
58
|
+
"type": "number",
|
|
59
|
+
"exclusiveMinimum": 0,
|
|
60
|
+
"maximum": 1
|
|
61
|
+
},
|
|
62
|
+
"domains": {
|
|
63
|
+
"type": "array",
|
|
64
|
+
"minItems": 1,
|
|
65
|
+
"items": {
|
|
66
|
+
"enum": ["financial", "medical", "legal", "hr", "identity", "contact", "technical", "general"]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"description": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"minLength": 1
|
|
72
|
+
},
|
|
73
|
+
"examples": {
|
|
74
|
+
"description": "Strings that MUST match the compiled pattern (and pass validate, if any); drives the cross-runtime conformance test",
|
|
75
|
+
"type": "array",
|
|
76
|
+
"minItems": 1,
|
|
77
|
+
"items": { "type": "string", "minLength": 1 }
|
|
78
|
+
},
|
|
79
|
+
"falsePositiveNotes": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"minLength": 1
|
|
82
|
+
},
|
|
83
|
+
"validate": {
|
|
84
|
+
"description": "Name of a post-match validation function in the runtime validator registry",
|
|
85
|
+
"type": "string",
|
|
86
|
+
"pattern": "^[a-z][a-zA-Z0-9]*$"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
package/rules/se.json
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
{
|
|
2
|
+
"region": "se",
|
|
3
|
+
"rules": [
|
|
4
|
+
{
|
|
5
|
+
"id": "regex:se:personnummer",
|
|
6
|
+
"entityType": "SSN",
|
|
7
|
+
"pattern": "\\b\\d{6}[-+]?\\d{4}\\b",
|
|
8
|
+
"flags": "g",
|
|
9
|
+
"confidence": 0.85,
|
|
10
|
+
"domains": [
|
|
11
|
+
"identity",
|
|
12
|
+
"hr",
|
|
13
|
+
"medical"
|
|
14
|
+
],
|
|
15
|
+
"description": "Swedish personnummer (YYMMDD-XXXX or YYMMDDXXXX)",
|
|
16
|
+
"examples": [
|
|
17
|
+
"850523-0006",
|
|
18
|
+
"8505230006"
|
|
19
|
+
],
|
|
20
|
+
"validate": "personnummer"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "regex:se:personnummer_12",
|
|
24
|
+
"entityType": "SSN",
|
|
25
|
+
"pattern": "\\b(?:19|20)\\d{6}[-+]?\\d{4}\\b",
|
|
26
|
+
"flags": "g",
|
|
27
|
+
"confidence": 0.9,
|
|
28
|
+
"domains": [
|
|
29
|
+
"identity",
|
|
30
|
+
"hr",
|
|
31
|
+
"medical"
|
|
32
|
+
],
|
|
33
|
+
"description": "Swedish personnummer 12-digit format (YYYYMMDD-XXXX)",
|
|
34
|
+
"examples": [
|
|
35
|
+
"19850523-1478",
|
|
36
|
+
"198505231478"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "regex:se:samordningsnummer",
|
|
41
|
+
"entityType": "SSN",
|
|
42
|
+
"pattern": "\\b\\d{6}[-+]?\\d{4}\\b",
|
|
43
|
+
"flags": "g",
|
|
44
|
+
"confidence": 0.7,
|
|
45
|
+
"domains": [
|
|
46
|
+
"identity"
|
|
47
|
+
],
|
|
48
|
+
"description": "Swedish samordningsnummer (coordination number, day +60)",
|
|
49
|
+
"examples": [
|
|
50
|
+
"850583-1478"
|
|
51
|
+
],
|
|
52
|
+
"falsePositiveNotes": "Same format as personnummer — differentiated by day > 60",
|
|
53
|
+
"validate": "samordningsnummer"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "regex:se:organisationsnummer",
|
|
57
|
+
"entityType": "SSN",
|
|
58
|
+
"pattern": "\\b\\d{6}-?\\d{4}\\b",
|
|
59
|
+
"flags": "g",
|
|
60
|
+
"confidence": 0.6,
|
|
61
|
+
"domains": [
|
|
62
|
+
"financial",
|
|
63
|
+
"legal"
|
|
64
|
+
],
|
|
65
|
+
"description": "Swedish organisationsnummer (company number, 10 digits)",
|
|
66
|
+
"examples": [
|
|
67
|
+
"556036-0793"
|
|
68
|
+
],
|
|
69
|
+
"falsePositiveNotes": "Same 10-digit format as personnummer"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"id": "regex:se:phone",
|
|
73
|
+
"entityType": "PHONE",
|
|
74
|
+
"pattern": "\\b(?:\\+?46[\\s-]?)?0?\\d{1,3}[\\s-]?\\d{2,3}[\\s-]?\\d{2}[\\s-]?\\d{2}\\b",
|
|
75
|
+
"flags": "g",
|
|
76
|
+
"confidence": 0.75,
|
|
77
|
+
"domains": [
|
|
78
|
+
"contact"
|
|
79
|
+
],
|
|
80
|
+
"description": "Swedish phone number (variable-length area code)",
|
|
81
|
+
"examples": [
|
|
82
|
+
"+46 8 123 45 67",
|
|
83
|
+
"070-123 45 67"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": "regex:se:postal",
|
|
88
|
+
"entityType": "ADDRESS",
|
|
89
|
+
"pattern": "\\b\\d{3}\\s?\\d{2}\\s+[\\p{L}][\\p{L}\\s-]+\\b",
|
|
90
|
+
"flags": "gu",
|
|
91
|
+
"confidence": 0.8,
|
|
92
|
+
"domains": [
|
|
93
|
+
"contact"
|
|
94
|
+
],
|
|
95
|
+
"description": "Swedish postal code (XXX XX) followed by city name",
|
|
96
|
+
"examples": [
|
|
97
|
+
"111 22 Stockholm",
|
|
98
|
+
"41301 Göteborg"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"id": "regex:se:currency_words",
|
|
103
|
+
"entityType": "CURRENCY",
|
|
104
|
+
"pattern": "(?:(?:med\\s+)?(?:bokstäver|ord)\\s*:\\s*|(?:summan|beloppet)\\s+)[\\p{L}\\s-]+(?:kronor|öre)\\b",
|
|
105
|
+
"flags": "giu",
|
|
106
|
+
"confidence": 0.9,
|
|
107
|
+
"domains": [
|
|
108
|
+
"financial"
|
|
109
|
+
],
|
|
110
|
+
"description": "Swedish amount written in words (e.g., \"med bokstäver: åttatusen femhundra kronor\")",
|
|
111
|
+
"examples": [
|
|
112
|
+
"med bokstäver: åttatusen femhundra kronor"
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"id": "regex:se:street",
|
|
117
|
+
"entityType": "ADDRESS",
|
|
118
|
+
"pattern": "[\\p{L}][\\p{L}\\s-]*(?:gatan|vägen|stigen|torget|platsen|gränd|backen|liden|ängen)\\s+\\d+[\\p{L}]?",
|
|
119
|
+
"flags": "giu",
|
|
120
|
+
"confidence": 0.9,
|
|
121
|
+
"domains": [
|
|
122
|
+
"contact"
|
|
123
|
+
],
|
|
124
|
+
"description": "Swedish street address (name + gatan/vägen/etc. + number)",
|
|
125
|
+
"examples": [
|
|
126
|
+
"Drottninggatan 42",
|
|
127
|
+
"Sveavägen 15",
|
|
128
|
+
"Stortorget 3"
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"id": "regex:se:company",
|
|
133
|
+
"entityType": "COMPANY",
|
|
134
|
+
"pattern": "[\\p{L}][\\p{L}\\s&.']+(?:\\s+)?(?:AB|HB|KB)\\b",
|
|
135
|
+
"flags": "gu",
|
|
136
|
+
"confidence": 0.8,
|
|
137
|
+
"domains": [
|
|
138
|
+
"legal",
|
|
139
|
+
"financial"
|
|
140
|
+
],
|
|
141
|
+
"description": "Swedish company name with legal form (AB, HB, KB)",
|
|
142
|
+
"examples": [
|
|
143
|
+
"Volvo AB",
|
|
144
|
+
"Handelsbanken AB",
|
|
145
|
+
"Ericsson AB"
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
{
|
|
2
|
+
"region": "universal",
|
|
3
|
+
"rules": [
|
|
4
|
+
{
|
|
5
|
+
"id": "regex:universal:email",
|
|
6
|
+
"entityType": "EMAIL",
|
|
7
|
+
"pattern": "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}",
|
|
8
|
+
"flags": "g",
|
|
9
|
+
"confidence": 0.95,
|
|
10
|
+
"domains": [
|
|
11
|
+
"contact"
|
|
12
|
+
],
|
|
13
|
+
"description": "Email address",
|
|
14
|
+
"examples": [
|
|
15
|
+
"john@example.com",
|
|
16
|
+
"user.name+tag@domain.co.uk"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "regex:universal:phone_intl",
|
|
21
|
+
"entityType": "PHONE",
|
|
22
|
+
"pattern": "\\+\\d[\\d\\s()-]{7,18}\\d",
|
|
23
|
+
"flags": "g",
|
|
24
|
+
"confidence": 0.85,
|
|
25
|
+
"domains": [
|
|
26
|
+
"contact"
|
|
27
|
+
],
|
|
28
|
+
"description": "International phone number with + prefix",
|
|
29
|
+
"examples": [
|
|
30
|
+
"+1 (555) 123-4567",
|
|
31
|
+
"+48 600 123 456",
|
|
32
|
+
"+44 20 7946 0958"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": "regex:universal:iban",
|
|
37
|
+
"entityType": "IBAN",
|
|
38
|
+
"pattern": "\\b[A-Z]{2}\\s?\\d{2}[\\s]?[A-Z\\d\\s]{10,30}\\b",
|
|
39
|
+
"flags": "g",
|
|
40
|
+
"confidence": 0.9,
|
|
41
|
+
"domains": [
|
|
42
|
+
"financial"
|
|
43
|
+
],
|
|
44
|
+
"description": "IBAN (2-letter country code + 2 check digits + up to 30 alphanumeric)",
|
|
45
|
+
"examples": [
|
|
46
|
+
"GB29 NWBK 6016 1331 9268 19",
|
|
47
|
+
"DE89 3704 0044 0532 0130 00",
|
|
48
|
+
"PL61 1090 1014 0000 0712 1981 2874"
|
|
49
|
+
],
|
|
50
|
+
"validate": "ibanMod97"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "regex:universal:credit_card",
|
|
54
|
+
"entityType": "CREDIT_CARD",
|
|
55
|
+
"pattern": "\\b\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{1,7}\\b",
|
|
56
|
+
"flags": "g",
|
|
57
|
+
"confidence": 0.9,
|
|
58
|
+
"domains": [
|
|
59
|
+
"financial"
|
|
60
|
+
],
|
|
61
|
+
"description": "Credit/debit card number (13-19 digits, possibly spaced/dashed)",
|
|
62
|
+
"examples": [
|
|
63
|
+
"4532 0151 1283 0366",
|
|
64
|
+
"5425-2334-3010-9903"
|
|
65
|
+
],
|
|
66
|
+
"falsePositiveNotes": "Luhn validation reduces false positives from random digit sequences",
|
|
67
|
+
"validate": "luhn"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "regex:universal:currency_symbol_prefix",
|
|
71
|
+
"entityType": "CURRENCY",
|
|
72
|
+
"pattern": "[$€£¥₹₽₩₺₴]\\s?\\d{1,3}(?:[,.\\s]\\d{3})*(?:[.,]\\d{1,2})?\\b",
|
|
73
|
+
"flags": "g",
|
|
74
|
+
"confidence": 0.8,
|
|
75
|
+
"domains": [
|
|
76
|
+
"financial"
|
|
77
|
+
],
|
|
78
|
+
"description": "Currency amount with leading symbol ($, €, £, ¥, ₹, ₽, ₩, ₺, ₴)",
|
|
79
|
+
"examples": [
|
|
80
|
+
"$45,000",
|
|
81
|
+
"€1.234,56",
|
|
82
|
+
"£100.00",
|
|
83
|
+
"¥50,000"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": "regex:universal:currency_code_suffix",
|
|
88
|
+
"entityType": "CURRENCY",
|
|
89
|
+
"pattern": "\\b\\d{1,3}(?:[,.\\s]\\d{3})*(?:[.,]\\d{1,2})?\\s?(?:USD|EUR|GBP|CHF|JPY|PLN|SEK|NOK|DKK|CZK|HUF|RON|BGN|HRK|RUB|UAH|TRY|BRL|ARS|MXN|COP|CLP|PEN|INR|CNY|KRW|AUD|CAD|NZD|ZAR|SGD|HKD|TWD|THB|MYR|IDR|PHP|VND|AED|SAR|QAR|KWD|BHD|OMR|ILS|EGP|NGN|KES|GHS|TZS|UGX)\\b",
|
|
90
|
+
"flags": "g",
|
|
91
|
+
"confidence": 0.8,
|
|
92
|
+
"domains": [
|
|
93
|
+
"financial"
|
|
94
|
+
],
|
|
95
|
+
"description": "Currency amount with trailing ISO code (e.g., \"1,000.00 USD\")",
|
|
96
|
+
"examples": [
|
|
97
|
+
"1,000.00 USD",
|
|
98
|
+
"45 000 PLN",
|
|
99
|
+
"100.50 EUR"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "regex:universal:currency_symbol_suffix",
|
|
104
|
+
"entityType": "CURRENCY",
|
|
105
|
+
"pattern": "\\b\\d{1,3}(?:[,.\\s]\\d{3})*(?:[.,]\\d{1,2})?\\s?(?:zł|kr|Kč|lei|лв|Ft|kn|₽|грн|₺|R\\$|S\\/\\.|руб|₹|元|圆|円|원|ر\\.س|ر\\.ق|د\\.إ|₪|₦|₵|₱|₫|₸|₼|₾|฿|RM|Rp|đ)(?=\\s|$|[.,;:!?)}\\]])",
|
|
106
|
+
"flags": "g",
|
|
107
|
+
"confidence": 0.85,
|
|
108
|
+
"domains": [
|
|
109
|
+
"financial"
|
|
110
|
+
],
|
|
111
|
+
"description": "Currency amount with trailing local symbol (zł, kr, Kč, lei, etc.)",
|
|
112
|
+
"examples": [
|
|
113
|
+
"8 500,00 zł",
|
|
114
|
+
"1 200 kr",
|
|
115
|
+
"3.500 Kč",
|
|
116
|
+
"10 000 lei",
|
|
117
|
+
"5 000 Ft"
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"id": "regex:universal:ipv4",
|
|
122
|
+
"entityType": "IP_ADDRESS",
|
|
123
|
+
"pattern": "\\b(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\b",
|
|
124
|
+
"flags": "g",
|
|
125
|
+
"confidence": 0.9,
|
|
126
|
+
"domains": [
|
|
127
|
+
"technical"
|
|
128
|
+
],
|
|
129
|
+
"description": "IPv4 address",
|
|
130
|
+
"examples": [
|
|
131
|
+
"192.168.1.1",
|
|
132
|
+
"10.0.0.255",
|
|
133
|
+
"172.16.0.1"
|
|
134
|
+
],
|
|
135
|
+
"validate": "ipOctets"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"id": "regex:universal:ipv6",
|
|
139
|
+
"entityType": "IP_ADDRESS",
|
|
140
|
+
"pattern": "\\b(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}\\b",
|
|
141
|
+
"flags": "g",
|
|
142
|
+
"confidence": 0.9,
|
|
143
|
+
"domains": [
|
|
144
|
+
"technical"
|
|
145
|
+
],
|
|
146
|
+
"description": "IPv6 address (full form)",
|
|
147
|
+
"examples": [
|
|
148
|
+
"2001:0db8:85a3:0000:0000:8a2e:0370:7334"
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"id": "regex:universal:mac_address",
|
|
153
|
+
"entityType": "OTHER",
|
|
154
|
+
"pattern": "\\b[0-9a-fA-F]{2}(?::[0-9a-fA-F]{2}){5}\\b",
|
|
155
|
+
"flags": "g",
|
|
156
|
+
"confidence": 0.85,
|
|
157
|
+
"domains": [
|
|
158
|
+
"technical"
|
|
159
|
+
],
|
|
160
|
+
"description": "MAC address (colon-separated)",
|
|
161
|
+
"examples": [
|
|
162
|
+
"00:1B:44:11:3A:B7"
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"id": "regex:universal:date_numeric",
|
|
167
|
+
"entityType": "DATE",
|
|
168
|
+
"pattern": "\\b\\d{1,2}[./]\\d{1,2}[./]\\d{4}\\b",
|
|
169
|
+
"flags": "g",
|
|
170
|
+
"confidence": 0.75,
|
|
171
|
+
"domains": [
|
|
172
|
+
"general"
|
|
173
|
+
],
|
|
174
|
+
"description": "Numeric date (dd.mm.yyyy, dd/mm/yyyy, mm/dd/yyyy)",
|
|
175
|
+
"examples": [
|
|
176
|
+
"15.03.2025",
|
|
177
|
+
"03/15/2025",
|
|
178
|
+
"1.1.2024"
|
|
179
|
+
],
|
|
180
|
+
"falsePositiveNotes": "Cannot distinguish dd/mm/yyyy from mm/dd/yyyy — both valid"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"id": "regex:universal:date_iso",
|
|
184
|
+
"entityType": "DATE",
|
|
185
|
+
"pattern": "\\b\\d{4}-\\d{2}-\\d{2}\\b",
|
|
186
|
+
"flags": "g",
|
|
187
|
+
"confidence": 0.8,
|
|
188
|
+
"domains": [
|
|
189
|
+
"general"
|
|
190
|
+
],
|
|
191
|
+
"description": "ISO 8601 date (yyyy-mm-dd)",
|
|
192
|
+
"examples": [
|
|
193
|
+
"2025-03-15",
|
|
194
|
+
"1990-01-01"
|
|
195
|
+
]
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"id": "regex:universal:date_word",
|
|
199
|
+
"entityType": "DATE",
|
|
200
|
+
"pattern": "\\b\\d{1,2}\\s+[\\p{L}]{3,}\\s+\\d{4}\\b",
|
|
201
|
+
"flags": "gu",
|
|
202
|
+
"confidence": 0.8,
|
|
203
|
+
"domains": [
|
|
204
|
+
"general"
|
|
205
|
+
],
|
|
206
|
+
"description": "Date with month name in any language (e.g., \"10 marca 2025\", \"15 March 2025\")",
|
|
207
|
+
"examples": [
|
|
208
|
+
"10 March 2025",
|
|
209
|
+
"15 marca 2025",
|
|
210
|
+
"1 janvier 2024"
|
|
211
|
+
]
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"id": "regex:universal:date_month_first",
|
|
215
|
+
"entityType": "DATE",
|
|
216
|
+
"pattern": "\\b(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\\s+\\d{1,2},?\\s+\\d{4}\\b",
|
|
217
|
+
"flags": "gi",
|
|
218
|
+
"confidence": 0.85,
|
|
219
|
+
"domains": [
|
|
220
|
+
"general"
|
|
221
|
+
],
|
|
222
|
+
"description": "English date with month name first (e.g., \"March 15, 2025\")",
|
|
223
|
+
"examples": [
|
|
224
|
+
"March 15, 2025",
|
|
225
|
+
"Jan 1 2024",
|
|
226
|
+
"December 25, 2023"
|
|
227
|
+
]
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"id": "regex:universal:labeled_id",
|
|
231
|
+
"entityType": "SSN",
|
|
232
|
+
"pattern": "(?<=[\\p{L}][\\p{L}\\s]{0,30}[:#]\\s?)[A-Z0-9]{2,4}[\\s-]?[\\d]{4,}(?:[\\s-][\\d]+)*",
|
|
233
|
+
"flags": "giu",
|
|
234
|
+
"confidence": 0.7,
|
|
235
|
+
"domains": [
|
|
236
|
+
"identity",
|
|
237
|
+
"general"
|
|
238
|
+
],
|
|
239
|
+
"description": "Labeled identifier (Key: Value pattern, e.g., \"ID: ABC12345\", \"Ref: 987654\")",
|
|
240
|
+
"examples": [
|
|
241
|
+
"ID: ABC12345"
|
|
242
|
+
],
|
|
243
|
+
"falsePositiveNotes": "Broad pattern — catches many key:value pairs that may not be PII"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"id": "regex:universal:long_number",
|
|
247
|
+
"entityType": "SSN",
|
|
248
|
+
"pattern": "(?<![.\\d])\\b\\d[\\d\\s-]{7,}\\d\\b(?![.\\d])",
|
|
249
|
+
"flags": "g",
|
|
250
|
+
"confidence": 0.5,
|
|
251
|
+
"domains": [
|
|
252
|
+
"identity",
|
|
253
|
+
"financial"
|
|
254
|
+
],
|
|
255
|
+
"description": "Standalone long digit sequence (8+ digits) — likely IDs, account numbers, case numbers",
|
|
256
|
+
"examples": [
|
|
257
|
+
"123456789",
|
|
258
|
+
"123-456-789-00"
|
|
259
|
+
],
|
|
260
|
+
"falsePositiveNotes": "Low confidence — many non-PII numbers match. Overlap resolution with specific patterns prevents double-detection."
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"id": "regex:universal:postal_city",
|
|
264
|
+
"entityType": "ADDRESS",
|
|
265
|
+
"pattern": "\\b\\d{2,5}[-\\s]?\\d{2,4}\\s+[\\p{L}][\\p{L}]+\\b",
|
|
266
|
+
"flags": "gu",
|
|
267
|
+
"confidence": 0.65,
|
|
268
|
+
"domains": [
|
|
269
|
+
"contact"
|
|
270
|
+
],
|
|
271
|
+
"description": "Postal/zip code followed by city name (various country formats)",
|
|
272
|
+
"examples": [
|
|
273
|
+
"00-950 Warszawa",
|
|
274
|
+
"75008 Paris"
|
|
275
|
+
],
|
|
276
|
+
"falsePositiveNotes": "May match non-address number+word sequences"
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
}
|