Remove non-numeric characters from the CPF

how to remove non-numeric characters from the CPF?

for example I have a CPF 424.087.938-82
and wanted it to be 42408793882

Hi @Beatriz,

Please use Regex to extract the numbers. Use the β€œMatches” activity and enter the pattern β€œ\d+” to get the numbers.

Here’s an example:
Regex String.xaml (8.0 KB)

Regards,
PD

Hi Beatriz.
You can use Replace function with β€œ.” to β€œβ€.

CPF.Replace(β€œ.”,β€œβ€)
CPF.Replace(β€œ-”,β€œβ€)

@Beatriz

Use Replace Activity in UiPath

Pattern- (CPF)|[.-\s]+
Input - CPF 424.087.938-82
Regex Option : (IgnoreCase, Compiled)
Replacement - String.Empty

Regards,
Mahesh

1 Like