Wildcard which includes and excludes at once

Hi, as already asked at Wildcard for exact number of consecutive characters?, I very often have the problem that it is not possible to enter a wildcard for:
=> a very concrete - literal - string (which also includes upper and lower case letters as well as spaces) - and what also concerns for the EXCLUSION of a filename which contains a very concrete - literal - string (which also includes upper and lower case letters as well as spaces) ... every time I despair of it - and maybe other users too, so it might make sense to create a shortcut for a wildcard-sign that meets these requirements.

Concretely I have just the following example, where the two file names should be made match different (especially not partially double):

  • 22-07-29¦17.47¦-INPUT MrAAA - Further Info -- via 22-08-01¦09.42¦-INPUT MrBBB.msg
  • 22-08-01¦09.42¦-INPUT MrBBB with 22-07-29¦17.47¦-INPUT MrAAA - Further Info.msg

On the one way the wildcard should be: *(INPUT MrAAA)* without! also matching *(INPUT MrBBB)*
on the other way *(INPUT MrBBB)*

I have already tried with different wildcards (e.g. with #, ', ?, ~, [~]), but everything did not work, in particular not:

  • *(INPUT MrAAA[~INPUT MrBBB with])* OR *(INPUT MrAAA[~*(INPUT MrBBB with)*])* and
  • *(INPUT MrBBB with)*

Maybe someone has a tip with the existing wildcards
Thx. a lot

What's the context that you need to use the wildcards in?

You can do both inclusions and exclusions at once using regular expressions, if regex can be used in the place you need to do this. But there may also be other/better ways, depending on what you're doing.

Hi Leo, thanks for your answer.
the wildcards I quoted are each only a part of a very long wildcard, which also contains other persons as senders, e.g. the first wildcard completely (in the following the sender names are anonymized with aaa, bbb, ccc etc.):

*($|INPUT MrAAA|INPUT (*~an)aaa|INPUT(-01|-02|-03|-04) (*)bbb|INPUT*ccc|INPUT ddd|SS eee|INPUT EM fff|INPUT E-Mail ggg|INPUT(|-01|-02|-03|-04) (hhh~((an RA hhh)))|INPUT*iii|INPUT jjj|INPUT jjj#|INPUT kkkRA#|INPUT EM kkkRA#|mmm-nnn an)*

If in the respective file name one of the aforementioned wildcards is contained, the respective files are to be represented in a certain color, so that one can distinguish them from other files faster (so that thus an optically colored catagorization is).

General info of my goal:
In my example, a person named 'MrBBB' sent me an MSG-email with an MSG-email-file from another person named 'MrAAA' attached to it ... I want to store these two MSG-email-files with different colors and different thickness of the fonts.

So far this works quite well, so I:

The problem I have is that I want to see two files visually with different colors, but both - also - containing the same characters, so in my above example the second file - also - contains 22-07-29¦17.47¦-INPUT MrAAA (like the first file), but should NOT be matched by the FIRST wildcard (and vice-versa), so this wanted to EXCLUDE on the first wildcard with the characters [~INPUT MrBBB with] contained ONLY in the second file.

It would be easiest for me and perhaps also for other users who - like me - have very little knowledge about regular expressions and for whom regular expressions for a very quick wildcard creation is too complicated and takes a lot of time, if one had a (new) ► Pattern Matching Syntax e.g. with the character = as wildcard to define a very EXACT case-sensitive string after this character (which one could then also simply integrate into the [~] exclusion), so in my example:
(1) *(=INPUT MrAAA[~INPUT MrBBB with])* OR *(=INPUT MrAAA[~=INPUT MrBBB with])* and
(2) *(=INPUT MrBBB with)*

In my opinion, such wilkdcard definitions would be done quite quickly for every user without having to "bother" with the complicated regular expressions in everyday life as a layman of regular expressions.

I'm still not sure where the wildcards are being input but it sounds like you're either:

  • defining a dynamic label (not a good idea as it would be very slow to search file contents all the time)


  • doing a selection or find-files, and then applying a simple label to the results.

If that is the case, you can use a multi-part filter to do the same thing, using simple wildcards. One (or more) wildcards can include certain text found inside the files, and another (or others) can exclude other text inside the files.

The exact way to use the filter will depend slightly on exactly what you're doing with the filter (label, selection, find-files, etc.), which I don't think you've told us yet, unless I have missed that in all the details (apologies if I have).

Re-reading, maybe I was mistaken that you are searching file contents. If it's just file names then the same sort of thing can be done, using multiple Name elements in the filter (instead of any Contains elements).

Need to know where you are using this to advise properly, though.

Thanks for your answers, Leo.

There may have been a little misunderstanding about what my (main) goal is, so here's an additional explanation:

Via Preferences -> Favorites and Recent -> Label Assignments I have defined a lot of GLOBAL -> Concrete difference/s between "label-filter" and "wildcard-filter"? - Help & Support - Directory Opus Resource Centre (dopus.com) "wildcard labels/filters" with second the button above with name "Create a new wildcard label" , so that all files in my dopus are (should be) displayed especially with different colors and/or symbols - e.g. depending on a certain sender name of an Outlook MSG-email message.

For example, since I am an attorney, an email or PDF from client or partner attorneys will be displayed with a different color than emails or PDFs from opposing party or opposing attorneys.

Therefore, in the above example, my goal is to display the MSG-email or PDF from the partner attorney named "MrBBB" in a different color in DOPUS than an MSG-email or PDF from the opposing attorney named "MrAAA" (which may also may be forwarded from a partner attorney "MrBBB") and which should be displayed with a different color accordingly:

  1. the email from the partner attorney "MrBBB" with the file name "22-08-01¦09.42¦-INPUT MrBBB with 22-07-29¦17.47¦-INPUT MrAAA - Further Info.msg" in color blue, and

  2. the actual email (forwarded by partner attorney "MrBBB") from opposing attorney "MrAAA" with the file name "22-07-29¦17.47¦-INPUT MrAAA - Further Info -- via 22-08-01¦09.42¦-INPUT MrBBB.msg"in color red.

Was I able to make it clear what my goal and problem (see please above and in the original link at the top) are? - My above codes are EXTRACTS from my existing wildcard labels/filters that I added with "Create a new wildcard label".

Might actually be easier (especially for long term use) to put the logic into a script column, that returns a color code which can be interpreted by a label filter.

If you want labels which do both inclusions and exclusions using wildcards, without getting into regular expressions or scripting, then you can do that.

Instead of creating a Wildcard Label, click the button to the left of it which creates a label using a Filter instead. You can then define multiple Name conditions with wildcards which need to match to not-match the filenames.

I said in the old thread to stick to Wildcard Labels if all you need is a wildcard, since they're less complex. But if you need more complexity (including multiple wildcards and boolean logic) then that's exactly what Filter labels are for. And if they are just doing multiple wildcard patterns, they won't cause any trouble. (Trouble starts when Filter labels start doing things that are expensive to calculate, such as things that require opening every file to get information from it.)

Hi lxp, thanks for your answer.
On the one hand, I don't want to use label-filters anymore, because otherwise they become very, very much (I had this once in the past and there were already more than 200 at that time, which also resulted in computational effort, so that Dopus displayed the files slower).
In addition, as a lawyer (not a technician/programmer), I am not familiar with scripting and it seems very complicated to me, especially when I want to define labels "only once quickly" in everyday life.

Hi Leo, also thanks for your answer.
As I just wrote lxp, I don't want to use label filters anymore, but only wildcard filters - especially since the situation described in my example above happens very often, so wildcard filters are more suitable for that reason alone.

So my question again: Why do the wildcard filters I mentioned at the beginning not work?

And: What speaks against that one above all as not programmers, thus "end user" get the possibility to create » with « - NEW - wildcard-sign(s)
=> EXACT case-sensitive literal strings in wildcard filter (which also includes upper and lower case letters as well as spaces) - what also concerns for the EXCLUSION of a filename which contains a very concrete EXACT case-sensitive literal strings in wildcard filter (which also includes upper and lower case letters as well as spaces)?

There shouldn't be a big speed difference if the filters are only testing wildcards. Have you tried it?

Because the wildcard syntax doesn't work like that. It's quite hard to do both inclusion and exclusion at once in a single wildcard.

If you want to do everything in a single line, you'd need to use regular expressions, which can do a "negative lookahead" to exclude something while also including another thing. But that will be more complicated than the route I suggested.