Search code examples
regexgoogle-cloud-dlp

GCP - DLP - Regex


Trying to process a BigQuery table with a custom infotype of RegEx variety.

RegEx I am using: ^(\d{5})$

In table below, I am trying to tag only against the "Codes" which are 5 digits. With the above RegEx, there are 0 matches.

With the following RegEx: \d{5}

It matches against all instances of 5 digits (including the two in Other)

How do I get it so that it only matches against 5 digits at the start of a "cell"(?) and ending with the 5th digit? Thanks a lot, been bogged down by this.

Name | Other     | Code
Blah | Test12345 | 12345
Bleh | 54311Test | 54311

Solution

  • Try following RegEx:

    \b\d{5}\b