Need suggestion on filename's regex


I need help on the regular expression.
I have a list of files whose name I need to match with a string and do some activities.

The name pattern can be like this below “word1 word2 word3” or “Word1 Word2 Word3” or it can be “word1_word2_word3” or “Word1word2word3” etc.
The names may contain 2 words or more than 2 words and as you can see the first letter of every word can be in uppercase or lowercase and there can be underscore symbol as well.

As these are file names so user can provide underscores or spaces in between the words.

Any suggestion on the regular expression ?

@Debartha_Mitra_DE - With Ignore case, below search pattern covers your cases…

1 Like

As an alternate also with case ignore flag, but control on space and underscore:


Thanks so will this cover more than 2 number of words in the file names then ?

@Debartha_Mitra_DE - In the pattern shared by @ppr…change {3,} to {2,} – Then it will cover 2 to N no of pattern matching that criteria…

1 Like

have a look on following. Here @prasath17 and mine pattern is combined. So a teamwork :slight_smile: