RegEx and query examples for PII detection
Use the following examples to query data.
Table: RegEx and query examples for PII detection
Data | Use RegEx type: |
|---|---|
To find MasterCard numbers without spaces (for example, 5500000000000004) | Single Term Regexp |
To find MasterCard numbers that might have spaces or dashes (for example, 5500 0000 0000 0004) | Advanced ElasticSearch Query "clauses": [ { "span_multi": { "match" : { "regexp": { "blob.content": "5[1-5][0-9]{2}" } } } }, { "span_multi": { "match" : { "regexp": { "blob.content": "[0-9]{4}" } } } }, { "span_multi": { "match" : { "regexp": { "blob.content": "[0-9]{4}" } } } }, { "span_multi": { "match" : { "regexp": { "blob.content": "[0-9]{4}" } } } } ], "slop": 0, "in_order": true } } |
To find Visa numbers without spaces (for example, 4111111111111111), | Single Term Regexp 4[0-9]{15} |
To find the Visa numbers that might have spaces or dashes (for example, 4111-1111-1111-1111) | Advanced ElasticSearch Query {"regexp":{"attachment.content":"4[0-9]{3}[ ]?[0-9]{4}[ ]?[0-9]{4}[ ]?[0-9]{4}|4[0-9]{3}[-]?[0-9]{4}[-]?[0-9]{4}[-]?[0-9]{4}"}} |
To find American Express numbers without spaces (for example, 340000000000009) | Single Term Regexp |
To find the American Express numbers that might have spaces or dashes (for example, 3400 0000 0000 009) | Advanced ElasticSearch Query {"regexp":{"attachment.content":"3[47][0-9][ ]?[0-9]{6}[ ]?[0-9]{6}|3[47][0-9][-]?[0-9]{6}[-]?[0-9]{6}"}}{ |
To find the United States Social Security Network (SSN) | Advanced ElasticSearch Query {"regexp": {"attachment.content": "~(000|666)[0-8][0-9]{2}[- ]?~(00)[0-9]{2}[- ]?~(0000)[0-9]{4}"}}{ |
To find content with particular text\phrase (for example, Good Admin) | Query String 'Good Admin' |