obsidian-tracker icon indicating copy to clipboard operation
obsidian-tracker copied to clipboard

Can't use regex in searchTarget with searchType: frontmatter?

Open ghost opened this issue 1 year ago • 1 comments

It seems that it's not possible to use a regex for searchTarget when using searchType: frontmatter?

If anyone knows how, I would really appreciate a pointer. If it's not possible, consider this a feature request.

Expected Behavior

I'm trying to use nested frontmatter like

habits:
    one: true
    two: false

that can be referenced as habits.one and habits.two. But because of this issue preventing that from working for me, I'm trying to use quasi nested frontmatter like

habits-one: true    
habits-two: false

that can be referenced with regular expression habits-.*. (The idea is to add up how many habits are true and display the sum in a bullet chart.)

But this isn't working for me.

Current Behavior

I just get an error: "no valid Y value"

Possible Solution

When using searchType: text, we can already use a regex for searchTarget. See here in the docs. I think adding support for the same thing when using searchType: frontmatter would make a lot of sense!

Steps to Reproduce (for bugs)

Just try using searchType: frontmatter and any regex for searchTarget.

ghost avatar Jan 14 '24 01:01 ghost

+1, facing the exact same issue, the frontmatter and tracker don't work as expected.

Frontmatter:

---
habit.waterIntake: 2
---

Tracker (doesn't work):

searchType: tag
searchTarget: habit.waterIntake
line:
  title: Water Intake

if I change the tracker type to text, it works perfectly:

searchType: text
searchTarget: habit.waterIntake
line:
  title: Water Intake

Looks like an issue with parsing nested YAML.

sahilarora535 avatar Feb 16 '24 08:02 sahilarora535