Extract CPF
Verb: extractCpf
Available from: <Enterprise>
Extracts CPF numbers from text using natural language processing.
Syntax
extractCpf --culture(Culture) --text(String) (List<String>)=values (String)=first (DataTable)=valuesmapping (Boolean)=success
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--culture | Language | Required | Culture | Language in which the defined text is written. Options:
The punctuation pattern changes according to the set language. |
--text | Text | Required | Text | Text that contains CPFs to extract. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
values | Values | List<Text> | List with the CPFs extracted from the text. |
first | First value | Text | The first CPF number extracted from the text. |
valuesmapping | Values mapping | Data Table | Data table with extracted CPFs and their information: id, starting position, size and text with the CPF. |
success | Success | Boolean | True if the command succeeds in extracting the CPFs, or False if it fails. |
Example
Extracts from a text CPFs of supposed clients and store the returns in variables.
defVar --name cpfsToExtract --type String --value "Name: Customer 1 , CPF: 818.453.580-58 \r\nName: Customer 2 , CPF: 196.031.710-50\r\nName: Customer 3 , CPF: 236.114.570-78\r\nName: Customer 4 , CPF: 359.415.820-99"
defVar --name cpfsExtractedList --type List --innertype String
defVar --name firstCpfObtained --type String
defVar --name success --type Boolean
extractCpf --culture en-US --text "${cpfsToExtract}" cpfsExtractedList=values firstCpfObtained=first success=success
logMessage --message "CPFs extracted list: ${cpfsExtractedList}\r\nFirst CPF obtained: ${firstCpfObtained}\r\nSuccess: ${success}" --type "Info"
// Result:
// CPFs extracted list: [818.453.580-58,196.031.710-50,236.114.570-78,359.415.820-99]
// First CPF obtained: 818.453.580-58
// Success: True
Remarks
CPF is a brazilian registry number equivalent to a Social Security Number in the US.