drbap / dashboard-navigator-for-obsidian

Dashboard navigator plugin for Obsidian.
MIT License
52 stars 0 forks source link

Questions about regex #5

Open merlinuwe opened 2 weeks ago

merlinuwe commented 2 weeks ago

I tried this, and it works as expected:

It shows me all notes with the tag #daily AND the tag #note AND NOT the tag #täglich.

(?=.#daily)(?=.#note)(?!.*#täglich)

(It would be useful, if you enhance the documentation with some examples like this.)


How can I exclude a folder with regex?

In my vault, I have a folder /BBZ/Artfiles which I want to exclude (but not in the plugin settings).


Is it possible to make it easier for the user to use regex code?

Is it possible to combine regex with a normal query?

Is there a documentation for the search engine you use?


Idea: What do you thing about something like this?

If the focus is in search/exclude the clicked tag/path/... gets to the chosen field.

If someone pressed <STRG> and clicks, the chosen search/exclude critera is added to the search-field which has the focus. (It does not overwrite the already text.)

image

drbap commented 2 weeks ago

Yes, the positive lookahead assertions (?=pattern) work as expected. The negative lookahead assertion (?!pattern) works for tags because they are in the same column. But this topic is for intermediate/advanced users, those with programming knowledge.

About plugin search and search documentation, I usually only have time during weekends to work on my side projects, so I didn't have time to write a complete search documentation, I only had time to work on the project itself (released the plugin and the updates). If the user has some knowledge of regular expressions (in JavaScript) it will be easier to use some advanced functionalities it can offer. But I will try to make it easier to use advanced search features with regular expressions or maybe create a SQL-similar way to interact with the plugin (SELECT or other basic query keywords).

About the regex lookaheads or lookbehinds, the performance can be different. I am happy with the current speed of the plugin search. It uses standard RegExp object to search (name, path, date, tags, etc). If I make this search too complex it can become too slow to use. My main goals with this plugin are to make it easy to use for both programmers and non-programmers, as quick as possible (dashboard information and search), and to be a robust plugin.

I will see what I can do about this regex topic. About the suggestion to trigger exclude folder with another key press combo <STRG> + click (<CTRL> in German keyboard), I have to think more about that. I like this idea, but in my humble opinion it is better and more user-friendly to achieve this functionality using text entered on the input search field. But this idea of using a key + click on the input field to have different functionality is interesting. You can Ctrl + left-click on the file links (open the file in new tab).

Thanks for the suggestions. Stay tuned for the future updates.

All the best