Need help with a smart group with a regex

I have a database where just about every file has a filename with a sortable date followed by the name of the file, such as:

2022-06-14 Receipt.pdf
2022-07-01 Bank Statement.pdf

Occasionally, a file gets misnamed such that it gets two dates, such as:

2022-07-01 2022-07-01 Property Tax.pdf

I created a smart group to find files with two dates in the name. The smart group looks like:

Where the regex is actually “^[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]” (without the quotes). I tested the regex at with the following input:

2022-06-14 Receipt.pdf
2022-06-15 2022-06-15 Property Tax.pdf
2022-07-01 Bank Statement.pdf

And it only matched the middle line, as would be expected. However, the smart group is matching all of my documents, not just the ones with two dates.

Any hints or suggestions? Thanks!

Note the emboldened words. Be specific in what you’re targeting, especially when testing things. Don’t target Databases; target that database.

Note: The matches isn’t using RegEx. It’s using the internal operators and wildcards. You could create a smart group that detects files that begin with a date string like 2022 [0-9][0-9] [0-9][0-9]then use a Scan Name > Regular Expression to process the individual names.

To use DEVONthink’s internal operators, you could use this construct…

As noted in the documentation’s Appendix > Search Operators, hyphens are ignored.

@BLUEFROG Thanks! I was able to create a smart rule that scans for the regex and opens a display alert to show me the files. I’m still refining it but I’m heading in the right direction.

You’re welcome :slight_smile: