Contain match too hungry?
Posted: Wed Jun 08, 2022 6:09 am
I have notes in markdown that I want to move to a subfolder based on the first (or only) hashtag that they contain.
For example, this is the top of a certain note:
I have created a rule that should match the tag and move it accordingly, using a custom attribute. It more-or-less works, but Hazel seems to either be too eager in matching or not match spaces/newlines at all, as it is matching the custom attribute as "agileBook" (ie. the last part of the tag that I want to match, but also the first word on the next line)
Here you can see the rule and what it matches:
A closer look at the "resource" custom attribute, which contains only characters. According to the hover text, it should only match non-blank characters:
And this is a closer look at the content Hazel seems to read:
Am I missing something here? Is Hazel not reading my file correctly, is there something wrong with my matching pattern, or is Hazel just too hungry in matching?
I've tried adding a space at the end of my matching pattern, but that doesn't seem to have any effect
For example, this is the top of a certain note:
author:: Trev de Vroome
source:: [Book Summary: Accelerate](https://tdevroome.medium.com/book-summa ... 31efe4c34c)
clipped:: [[2022-05-23]]
published:: 2019-10-18
#resources/agile
# Book Summary: Accelerate
![](https://miro.medium.com/max/700/0*CJxxTI-GC7s6-y8C.jpg)
Accelerate, by Nicole Forsgren PhD, Jez Humble, and Gene Kim
I have created a rule that should match the tag and move it accordingly, using a custom attribute. It more-or-less works, but Hazel seems to either be too eager in matching or not match spaces/newlines at all, as it is matching the custom attribute as "agileBook" (ie. the last part of the tag that I want to match, but also the first word on the next line)
Here you can see the rule and what it matches:
A closer look at the "resource" custom attribute, which contains only characters. According to the hover text, it should only match non-blank characters:
And this is a closer look at the content Hazel seems to read:
Am I missing something here? Is Hazel not reading my file correctly, is there something wrong with my matching pattern, or is Hazel just too hungry in matching?
I've tried adding a space at the end of my matching pattern, but that doesn't seem to have any effect