Expression to find format file

hi, i have to check each file in folder that have format “fileTestABCyyMMdd.xlsx” like this “fileTestABC200809.xlsx”
i’m trying use matches and need an Expressions but don’t know how to write it on RegExr to test it . Can someone teach me . Tks

HI,

Hope the following sample helps you.

System.Text.RegularExpressions.Regex.IsMatch(CurrentFile.Name,"^fileTestABC\d{6}\.xlsx$")

Sample20230209-6L.zip (13.1 KB)

Regards,

1 Like

oh sorry my faults i forgot, in the format “fileTestABCyyMMdd.xlsx” only " fileTest" is the same for everyfile i want to get every file that "ABCyyMMdd.xlsx” can be diff like
“fileTestDCV230209.xlsx”
“fileTestXYA221210.xlsx”

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.IsMatch(CurrentFile.Name,"^fileTest[A-Z]{3}\d{6}\.xlsx$")

OR

System.Text.RegularExpressions.Regex.IsMatch(CurrentFile.Name,"^fileTest[A-Za-z]{3}\d{6}\.xlsx$")

(if lower case letters might be included)

Sample20230209-6Lv2.zip (18.4 KB)

Regards,

1 Like

Tks u , now i learning it’s ez i need to learn more abour expression <3

1 Like

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