Depending on the type of scan you're doing ...
If by Content, then it will work by setting an Include Filter: *foobar*
And with that you're done.
If you're using Ignore Content, then you can only do it in a round-about kind of way...
You could do something like...
Include Filter: *foobar*
Ignore Content
Similar File Names
Problem is, when you Ignore Content, you must select an additional search criteria (Additional Options), such as Similar File Names, & what SFN finds & how it groups the files may not necessarily be what you're needing or expecting.
Anyhow, for searching for file
names nothing touches
Everything.
Then its a simple matter of 'foobar'.
Once you have found the files, then maybe you can organize them in such a way that it then makes it more natural for Duplicate Cleaner can find duplicates of 'foobar'.
So if all 'foobar' are uniquely named in some way, you can move (drag) them all into their own separate directory tree & run a DC search on them.
(Drop the filter, set your other criteria & have it scan just the one directory tree.)
And if they are not uniquely named, then maybe you can do that first (with a file renamer,
Bulk Rename Utility perhaps) which can do something like 'Append Folder Name' & if that's done, it may then make the file names "unique". And at that point, Everything still sees them, & given that they're uniquely named, you can move them all into ... their own separate directory tree, where you can then run a DC search on them.