Complex search operators

Hello,

I’m trying to create a Smart Group for all items with names which start with this date pattern: “2018-07-14 Whatever”. I can’t seem to get it to work.

I tried all of the following using “Name” + matches Operators & Wildcards:

???-??-?? *
[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]*
[0-9][0-9][0-9][0-9][-]*
[0-9][0-9][0-9][0-9]-*

I must be missing something because even trying to find items that starts with a number doesn’t work for me, with this syntax: “[0-9]*”. This just finds all items with a number anywhere followed by anything.

What is the proper syntax for this? I can’t find any complex examples in the help file or in the tutorial videos.

Thanks a lot.

DEVONthink searches are limited to alphanumeric characters only. Any non-alphanumeric characters included in your smart group search are ignored.

Edited to add a clarification that the non-alphanumeric characters that are assigned as wildcards in DEVONthink are evaluated as such.

OK thanks, but then how come this doesn’t work either?

[0-9][0-9][0-9][0-9][^0-9][0-9][0-9]*

Try this, as it finds 2018-07-14 in the text of the document for me.
Screen Shot 2018-07-14 at 13.22.24.png

Note that the ‘-’ characters in the search string are just returning a non alphanumeric character, not actually searching specifically for ‘-’. The string in the document could be 2018$07$14 in the text and it would find it the same. Likewise the search term could be input as [0-9][0-9[0-9][0-9]$[0-9][0-9]$[0-9][0-9] and it would find the date 2018-07-14 as well. As such, it may give unpredictable results by returning some documents that don’t exactly have the yyyy-mm-dd term in the text. I don’t have a better suggestion, perhaps Criss or Jim will have an idea.

Thanks, but it doesn’t work, I’ve tried that already. This expression also matches items with names like:

“Something else with a number like this 19710309.mov”
“A number in the middle 1966/12/01 like this one”
“nada543-dpvc214_vis_01111403_09170603”

Which makes the whole thing completely useless.

I can’t get any predictable outcome out of the expressions I try. The help file says that I can use [^0-9] to note a character which is excluded from that range, but I need to specify a character (such as the hyphen) which is excluded from both ranges [0-9] and [a-z], but this doesn’t work with two ranges (I tried “[^0-9a-Z]” and [^0-9,a-Z]).

I can’t believe a search filter so basic could pose such a problem.

Any ideas?

Thanks again.

EDIT: I managed (finally!) to get the syntax correctly, which weirdly is this (using a space instead of a NOT operator) “[0-9][0-9][0-9][0-9] [0-9][0-9] [0-9][0-9]”. This finds “1989-02-03” but not “1989902203” which is what I need. However, it finds it anywhere in the item name, and I need it to filter only items that BEGIN with that pattern.

The help file is correct, the caret will exclude a character from the range, but only alphanumeric characters. As the hyphen is a non-alphanumeric character, my understanding of how search works is that it is ignored, therefore cannot be excluded.

Refining the edit to my previous post above, the best I could come up with is this, including the quotes (which have a big impact):

“[0-9][0-9][0-9][0-9] [0-9][0-9] [0-9][0-9]”

It still isn’t restricted to the beginning of the item name but it has removed most of the false matches.

This is still a trial-and-error affair because I can’t find any clear documentation on the syntax, which looks a bit like regex without being regex.

BTW, I found that the best way to test this, rather than updating the Smart Group settings, clicking OK and waiting for a refresh, is to do it in a search window. It’s faster to test and you also get matches highlighting in yellow, which helps understand what’s going on.