Always 2 numbers after a name, separated by “_”, then 3 numbers, then 13 numbers.

But after that it can have 0, 1 or 2 numbers before a date and finally a value and that gets in the way
I need these 2 numbers between the 13 digits and the date.

So, first I need to know if there are 0, 1 or 2 numbers in that position.

After:
If you have 1 just take that information and assign it to a variable - call: var02

Now if it has 2 numbers, it must assign the first number to the variable
-call: var01
And then he assigns the second number to the variable
-call: var02

However, if he has neither, he must simply skip this step.

how can I do this without knowing the position in the string or even wondering if the value exists or not?

Hello @pedro.vieira - Welcome to the UiPath Forums Community!

It should be possible.

Can you explain your sample further / can you label the 0,1,2 number examples? I can’t see the 0 sample.

You could use Regex to obtain the string then use logic to determine the variables.
Or try multiple regex patterns - one for each variable. Then assign variables accordingly.

I have a pattern but need to know more to assist.
Pattern: (?<=\d{2}[^\d]+\d{3}\d{13}_)\w+

If 05/10 is the date, then the regular expression should be (?<=\d{2}_.*\d{3}_\d{13}_)\d+(_\d+)*(?=_\d{2}\/\d{2})

Use the Matches activity with the pattern above. Then use a For Each loop to go through all matched items. In the loop split the matched values like this: Parts = item.Value.Split("_"c)

If Parts.Count = 1 then Assign var01 = Parts(0)
If Parts.Count = 2 then Assign var01 = Parts(0) and var02 = Parts(1)