Spilt

D:\CHUPL_FILES\RPCMUMSB18JUNE22_SR12345678.xlsx

I want to spilt only SR12345678
Plz help

@AsadPathan2665,

Try like this, I assume that always you have only one Underscore in your filename.

Path.GetFileNameWithoutExtension("D:\CHUPL_FILES\RPCMUMSB18JUNE22_SR12345678.xlsx").Split("_"c)(1)

Hey!

Try this:

System.Text.RegularExpressions.Regex.Match("D:\CHUPL_FILES\RPCMUMSB18JUNE22_SR12345678.xlsx","(?<=\d{2}\D{4}\d{2}.)[A-Za-z0-9].+(?=.xlsx|pdf|doc|docx)").ToString

Reference:

Regards,
NaNi

HI @AsadPathan2665

How about this expression

System.Text.RegularExpressions.Regex.Match("D:\CHUPL_FILES\RPCMUMSB18JUNE22_SR12345678.xlsx","\d+\S+_(.*?)\d+\S+_(.*?)(?=.xlsx|pdf|doc)").Groups(1)

Regards
Gokul