Error when trying to get just the numbers from a string

Hi, I’m getting the error “Object reference not set to an instance of an object.” when trying to extract only the numbers from a string.

My string will always be something like CT.GM.8115.ITS or SP.MA.1027.RAL or FR.NZ.1519.DER … so I want to extract 8115, 1027, 1519 or the number that will come in my string.

I’m trying this expression:


I’ve inserted it in an Assign activity, a message box, a write line…I’ve also tryied using Match activity but I’m not able to get a string variable containing my 4 numbers. How can I do it? :worried:

Ideally it should work:

can you debug and find out where the null exception is raised? Have a check on duplicated variable names ind different scopes and that no argument exists with the same name as the used variable


Thanks @ppr it work, but how I can use my result as string to use it after on a selector as variable?

I’m having this:

I need to have a string with my number (example: 8115).
Note: It will always be only one codenumber for each execution of the workflow.

Hi @Airun

Try with this regular expression


Hope it works

Nived N :robot:

Happy Automation :slight_smile::slight_smile::slight_smile:

U have to loop through the element in the output of match activity

Inside the for each use


1 Like

PERFECT!! Thank you very much!! :star_struck: :clap:

1 Like

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