Extract numbers from text

Hi everyone.

How can I extract numbers from text.
For example if I have H7M00 or 13K18P but I only want to keep the numbers what formula can I use?

Thanks for any help provided.

Hi,

Do you want to convert “H7M00” to “700” and “13K18P” to “1318”?

If so, the following expression will work

System.Text.RegularExpressions.Regex.Replace(text,"\D","")

Regards,

3 Likes

Yes that’s what I am trying to do.

Sorry, I’m still at a beginner level, which activity am I supposed to use the formula with?

1 Like

Hello

You will need to get the text “H7M00” and “13K18P” into a string variable first (if in PDF, then use the “ReadPDF” activity - but you will need to be add it in by clicking “Manage Packages” → search for “PDF” under the official section).

You can simply use an “Assign” activity like this:

Left Side of Assign activity
string_Variable

=

Right side of Assign activity (from Yoichi’s post)
System.Text.RegularExpressions.Regex.Replace(INSERTVARIABLE,“\D”,“”)

2 Likes

@DadouSan Refer attached file for the solve. Just converted Yoichi’s input to a process file.
@Yoichi : Thanks for sharing this.

.Main.xaml (4.7 KB)

3 Likes

Wow thank you very much for all the answers. That’s help a lot.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.