How to get list items with dataview that have a date inside it

What I’m trying to do

i want to get all the list items from all the files that start with a date

my use case is that whenever i do something i will make a list item starting with a date that something has been done , i want to be able to view all the items as a log combined in a single file.

Things I have tried

TABLE L.text
FLATTEN file.lists AS L
WHERE contains(L.text, "logs")

with this i am able to get all list items that contain the word logs , but with this i have to enter the word log everywhere , i want it to work if a date is added

example

  • 2024-01-26 task one complete
  • 2024-02-27 status of server is ok
  • 2024-03-01 backup running ok
    etc

curently i have to do

  • 2024-01-26 logs task one complete
  • 2024-02-27 logs status of server is ok
  • 2024-03-01 logs backup running ok

(i also tried using tasks plugin for this but that has checkboxes , and i liked the task plugin so much that i started using it for tasks , and now i need something else for the logs, i dont want them to mix )

also tried this

TABLE L.text
FLATTEN file.lists AS L
WHERE regexmatch(/\d{4}-\d{2}-\d{2}/, L.text)

this gives error

Within a dataview query you use quotes to surround the regex, not slashes. In addition you want to limit your test to the start of the text, aka ^. Finally to not match against the entire text, use regextest() instead of regexmatch(). So then your query becomes:

```dataview
TABLE L.text
FLATTEN file.lists AS L
WHERE regextest("^\d{4}-\d{2}-\d{2}", L.text)
```

Which could be extended to something like:

```dataview
TABLE L.text
FLATTEN file.lists AS L
WHERE regextest("^\d{4}-\d{2}-\d{2}", L.text)
FLATTEN date(substring(L.text, 0, 10))  as theDate
SORT theDate
```

or whatever you want to use with that date portion. Grouping, sorting, filtering, …

thank you so much this worked perfectly.,

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.