How to extract number from file name

hello,
i’m using join pdf activity to… join pdf file in one ^^

my file look like “MR JAMBON BEURRE 123456.pdf”

Then, i assign a variable to my directories (which content joigned files)

I want to use Regex , to extract only the number on the file name. (just before extension)

I use the expression = (\d+)(?!.*\d)

But this not working, and i don’t how to do now …

Could you help me ?

Thanks a lot !

1 Like

Processing: regex.pdf…

Hello, welcome to the community!

Try out this expression:
image

(\d*)(=?.pdf)

Best,
Charbel

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Match(yourString,"\d+(?=\.[^.]+$)").Value

Regards,

Thank for your reply !

This expression (\d*)(=?.pdf) ,
and this expression System.Text.RegularExpressions.Regex.Match(Item.toString,“\d+(?=.[^.]+$)”).Value

return me this in the log =>
System.Linq.Enumerable+d__97`1[System.Text.RegularExpressions.Match]

Hi,

Can you try to use just Assign activity?

left side : string variable

right side:

System.Text.RegularExpressions.Regex.Match(yourString,"\d+(?=\.[^.]+$)").Value

Regards,

1 Like

Yes that’s ok it’s work
Thanks you Yoichi !

1 Like

how do you remember long syntax? every time