How can take only the check number from this string

how can take only the check number from this string

“C:\Users\app_eb\RPA\RPA_Work\Inmar_Cash_Posting\Input files\check_num_4000052862_06092023_1.xls”

i need only 4000052862 as a output

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Match(System.IO.Path.GetFileNameWithoutExtension(yourFileString),"\d+").Value

Regards,

System.Text.RegularExpressions.Regex.Match(yourString, “(?<=check_num_)\d+(?=\d{8})”)

Try using \d{10}+

number = System.Text.RegularExpressions.Regex.Match(System.IO.Path.GetFileNameWithoutExtension(yourFileString),“\d{10}+”).Value