Regex for filename

I am trying to use regex in order to get the filename. the filename is Supplier Creation Details - Clarisity Solutions 2. Can anyone tell me the regex for this filename?

can you provide the input & expected output

Regards,
Arivu

I want to get the file named “Supplier Creation Details - Clarisity Solutions 2.xlsx” from a folder using regex

Hi @Seema_Jethe ,
Can you provide the full input string, so that i can provide the Regex pattern

Regards,
Arivu

C:\Users\seema.jethe\Downloads\Supplier Creation 12-28-2021\Supplier Creation\Input Data\Clarisity Solutions Pvt Ltd 2\Supplier Creation Details - Clarisity Solutions 2.xlsx

@Seema_Jethe

Instead of Regex you can write as below

Path.GetFileNameWithoutExtension(“Your FolderPath”)

This will output only the FileName with out extenstion

Hope this may help you

Thanks

1 Like

@Seema_Jethe

Check as below

Hope this may help you

Thanks

1 Like

Hi @Seema_Jethe ,
Using regex pattern to get the file name
Activity : Replace
input : Your FilePath
Pattern : (.*\\)
Replacement : ""

RegexFileName.xaml (6.8 KB)

Regards,
Arivu

@arivu96 Thanks your solution helps but could u please tell me why ‘\’ is been used in regex?

Hi @Seema_Jethe ,

‘’ is used up ‘’ need to select in regex pattern. refer below link

Regards,
Arivu

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