Extract a number from a string

Dear Community,

Starting with a SAP automation, at the end, I would get the document number in a variable

I got this following string :
Document 99095065 has been saved

but I’m not able to get the number “99095065”

I tried several reponses from the forum but it is not working. Any idea to solve my issue ?
Thanks in advance for your help
Eric

@LECORVEC_Eric

Welcome to the community

Please try this in assign activity

Assume the string is in str and extracting to result of type atring

Result = System.Text.RegularExpressions.Regex.Match(str,"\d+").Value

The same can be done using matches activity as well…in configure select advanced and give \d and then select any number of matches from drop down instead of exact

Hope this helps

Cheers

Many thanks Anil it works

1 Like

Many thanks Anil
It works
Eric

1 Like

@LECORVEC_Eric

Happy Automation…

Cheers