I need to get a spesific string Iin between filepath

Hi,
I need to get a spesific string Iin between filepath
example :
String : D:\aaaaa\afq3\aveav32\aef2**This is the strting i want234**4.msg
output : This is the strting i want2344

how do i achive this?,

thanks
best regards
Ahmad

Hi,

Can you try the following?

System.IO.Path.GetFileNameWithoutExtension(yourString)

image

Regards,

Hi Yoichi
String : aaaaa\afq3\aveav32\This is the strting i want234.msg

will this eleminate the all character before " This ", since this string is a form of a filepath

HI @Ahmad_Rais

You can try with Regex

system.Text.RegularExpressions.Regex.Match("aaaaa\afq3\aveav32\aef2**This is the strting i want234**4.msg","(?<=\*\*).*(?=.msg)").Tostring

image

image

Regards
Gokul

HI @Ahmad_Rais

system.Text.RegularExpressions.Regex.Match("aaaaa\afq3\aveav32\aef2**This is the strting i want234**4.msg","(?=This).*(?=.msg)").Tostring

Hi,

I think the above expression will work as you expect.

image

Or do you also need .msg?

Regards,

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