How to match filenames with [1] at the end?

The best solution for finding and removing duplicate files.
User avatar
Joe Fox

How to match filenames with [1] at the end?

Post by Joe Fox »

I have tons of duplicates, all sets have a regular filename and the duplicate filename of filename[1].ext and I can't figure out how to select all files with [1] in the filename with the selection assistant.
User avatar
zz

Post by zz »

In select by pattern, try entering *[1]*
User avatar
Joe Fox

Post by Joe Fox »

I did that, and it matched all file names with the number 1 in them. I had also tried *[1].* but that matches any file name ending in a 1 (before the extension). The brackets are ignored. I was wondering if there was an escape character to have brackets be recognized as part of the string and not part of regular expression. Sort of like the \ and its function in perl. I've also tried \ for that matter, but no matches result.
User avatar
Fool4UAnyway

Post by Fool4UAnyway »

Did you try any of these?:

*\[1\]*
*\[1\]\..*

I'm not sure any of these will work.
User avatar
Joe Fox

Post by Joe Fox »

Like I said, I tried escaping the regex with \.. it didn't work.
User avatar
DV

Post by DV »

It doesn't use regex, it uses Like. It's not obvious, but I checked and you can escape the [ (which is a grouping character) using brackets:

*([)1(])*

DC2.0 has a plain text / regex matching option, so hopefully that should clear issues like this up!
Post Reply