Error while using regex.match - please help

Hi team I am using -

Index = Directory.GetFiles(“C:\Users\ggopalakrishnan\Desktop\test_duplicate”).Max(Function(f)CInt(System.Text.RegularExpressions.Match(Path.GetFileNameWithoutExtension(f),“\d+$”).Value))

Index is Int32 datatype

but I am getting below error -
image

kindly help

Regards,
Gokul

Hi @gokul1904

Try like this Pattern

Directory.GetFiles(“C:\Users\ggopalakrishnan\Desktop\test_duplicate”).Max(Function(f)CInt(System.Text.RegularExpressions.Regex.Match(Path.GetFileNameWithoutExtension(f),“\d+$”).Value))

You have Missed Regex in the expression → System.Text.RegularExpressions.Regex.Match

Regards
Gokul

1 Like

thank you @Gokul001 I had figured it out just but thanks for the fast response

1 Like

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