The regex you provide related to the Tasks plugin seems to be less than ideal: /\d\d\d\d-\d\d-\d\d January|February|March|April|May|June|July|August|September|October|November|December/
. If I’m not mistaken this will give a positive match on all of the following:
- 2023-12-01 January
- February
- March
- … and so on
What I’m trying to say is that the alternation character, if I’m not mistaken, will be on everything from the /
or previous |
to the next the |
or /
. If you wanted to actually have a match against the date for all month, you could need to group the last part, so maybe something like:
/\d\d\d\d-\d\d-\d\d (January|February|March|April|May|June|July|August|September|October|November|December)/
However, that doesn’t seem to be your main issue as you want to start using a Dataview query. The similar regex for dataview would look like:
regextest("^\d\d\d\d-\d\d-\d\d (January|February|March|April|May|June|July|August|September|October|November|December)", filename)
Note that using regextest()
does a partial match on its variables, whilst regexmatch()
must match on the entire string.
Examples using this regex
Put the following in a note, and check the result (or play around with similar test cases added to the list()
```dataview
TABLE WITHOUT ID filename, matches
FLATTEN list(
"nothing",
"2023-01-03 January 1st",
"Ooopsie, 2023-03-03 March 3rd",
"2023-05-03 May 3rd",
"9999-99-99 December 99th?") as filename
FLATTEN
regextest("^\d\d\d\d-\d\d-\d\d (January|February|March|April|May|June|July|August|September|October|November|December)", filename) as matches
WHERE file.path = this.file.path
```
Another question related to your Tasks query, what is included in your status.type is TODO
? Only - [ ]
or also - [/]
, any other status variants?
Assuming only those two we’re now at query looking like this:
```dataview
TASK
WHERE regextest("^\d\d\d\d-\d\d-\d\d (January|February|March|April|May|June|July|August|September|October|November|December)", file.name)
WHERE contains(list(" ", "/"), status)
GROUP BY file.name
SORT key desc
```
Does that resemble what you want out of the query?
Note the trick on doing SORT key
after the GROUP BY
clause.