Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

247
Views
How to redact possible phone number in string?

I am use Google Cloud DLP (node.js) for redact phone number from string (this string can contain other word). https://cloud.google.com/dlp/docs/samples/dlp-inspect-phone-number For example I want redact phone number in: Do transaction over phone to bypass fee. My number: 18776967786

But Cloud DLP only redact phone number with international format. For example +1-877-696-7786

Anyone know good method for iterate through string and redact possible phone number?

Thanks for help!

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

For your specific example, US_TOLLFREE_PHONE_NUMBER works as the infotype.

enter image description here

enter image description here

about 4 years ago · Juan Pablo Isaza Report

0

Without format or context you would need to turn on redaction of PHONE_NUMBER and GENERIC_ID with threshold of UNLIKELY 1.

about 4 years ago · Juan Pablo Isaza Report

0

As mentioned by @Jordanna Chord, US_TOLLFREE_PHONE_NUMBER works as infotype for given example. And for phone numbers other than US, you can use PHONE_NUMBER as infotype.

Specifying redactConfig redacts a given value by removing it completely. The redactConfig message has no arguments; specifying it enables its transformation. Refer redactConfig for more information.

Redact a given value. For example, if used with an InfoTypeTransformation transforming PHONE_NUMBER, and input 'My phone number is 206-555-0123', the output would be 'My phone number is '. You can specify one or more infoType transformations per request. Within each InfoTypeTransformation object, you specify both of the following:

  • One or more infoTypes to which a transformation should be applied (the infoTypes[] array object).
  • A primitive transformation (the PrimitiveTransformation object).

The challenge here is that if there's no context and no formatting, then a phone number may just look like a ~10 digit number. If you want to redact phone numbers you should mention the correct format. Or else, turn on redaction of PHONE_NUMBER and GENERIC_ID with a threshold of UNLIKELY to remove even if it is not mentioned in the format.

Example formats:

Item Result Likelihood
18776967786 GENERIC_ID UNLIKELY
877-696-7786 PHONE NUMBER POSSIBLE
877 696 7786 PHONE NUMBER POSSIBLE
+1 877 696 7786 PHONE NUMBER POSSIBLE
+18776967786 PHONE NUMBER POSSIBLE
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!