Extract word from a string

I want to extract 4500001833 from below string

“Standard PO created under the number 4500001833”

Hi @shruthi_arali

How about this expression?

System.Text.RegularExpressions.Regex.Match(YourString,"\d+$").Tostring

image

Regards
Gokul

Hi @shruthi_arali

You can use this RegEx pattern to extract the desired data:

\d+

image

UiPath Syntax:

extractedNumber = System.Text.RegularExpressions.Regex.Match("Standard PO created under the number 4500001833","\d+").ToString

Hope this helps,
Best Regards.

@shruthi_arali

If this is the only number then use

System.Text.RegularExpresions.Regex.Match(str,"\d+").Value

If that is the last value always then

Str.Split({" "},Stringsplitoptions.RemoveEmptyEntries).Last

Cheers

1 Like

Try to sue Number if it is static @shruthi_arali

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=number\s)\d+$").Tostring

Simple:
grafik

Anchored on end

Anchored on text
grafik

@shruthi_arali

System.Text.RegularExpressions.Regex.Match(YourString,“(?<=number\s)\d+”).Tostring

@shruthi_arali

Use this Regex:

\b\d{10}\b

Hi @shruthi_arali

Input= "Standard PO created under the number 4500001833"
Output= System.Text.RegularExpressions.Regex.Match(Input,"\d+$").Value

Hope it helps!!

Try this way @shruthi_arali

output : -
image

Hi @shruthi_arali
Try This Expression

output_val = System.Text.RegularExpressions.Regex.Match(“input value”,“(?<=number\s)\d+$”).Tostring

Thank you