Using Regex to find notes? Edict vs Agents pros/cons?

I typically Title my notes beginning with an “?” and ending with “?” to easily find them ex: ?Title?
I have in the past only use find however now I would like to build an agent, which leads me to the question: How would I best code this? Would it be best as an Edict vs Agent?

My documents are usually more focused but I do also keep a commonplace journal.

Thanks in advance,
Tom

If you use agents and search textually (i.e. is ‘abc’ os $SomeAttribute), you’ll likely soon move from literal matches such as ‘aaa’ to regex expressions such as ‘a{3}’ (which is the same, so perhaps a bit simplistic)

I’d advise against using characters as markers that are also regex special characters (the ‘code’ of regex patterns). For instance ‘a?’ means match the character ‘a’ one zero or more times, the one or more being implied by the question mark. This is from the documentation for the regex library used by Tinderbox.

Avoiding such characters will avoid annoyance down the road if you find you’ve planned around using certain characters that are then a pain to use in regex patterns.

What you type in the view pane Find box is essentially the pattern (Find can use regex) used in :

$Text.contains("pattern")
$Name.contains("pattern")

etc. Here is place to start reading up on matching text.

Edit: correction, as per next post. It also reminds that these special characters do things not always immediately to mind and which one should look up (I didn’t, my error!).

1 Like

Small correction: ‘a?’ means match ‘a’ zero or one times. ‘a+’ means match ‘a’ one or more times.

1 Like

Thanks again to you both…not sure why I did not think of $Name.icontains(“query”). It helps understanding how to begin to understand how to use the very powerful regex language. Will continue to explore and expand its use in my Tinderbox life.

Thanks again.
Tom

1 Like