What should I use to ensure a search that gives true only if any of those strings in full is searched for?
I was expecting search:myfield:literal[] to do this but e.g oo returns true. (I guess I literally don’t understand literal!) so it seems TW can’t do this directly but, surely, what I’m after can’t be totally uncommon - !?
I’m guessing(!) a regex would have to accept either of these forms: |xxx__xxx|_xxx_
i.e that the string is either a first or last in the field, or surrounded by whitespace) but I don’t know how to formulate such a regex.
literal here is talking about the search term, not the string being searched. So oo literally appears in there. I think you will need to resort to a regexp search. Assuming your text is simple (without regex special characters), you can do this by adding word boundary markers (\b) at the beginning and end.
[search:my-field:regexp[\boo\b]]
This matches oo ee oo aah aah but not foo bar baz.
Yeah, thanks… in my previous experience, I seem to always do something wrong when attempting to apply externally found regexps in TW. I think they need some syntax massaging to work in TW or something.
Exactly. But I didn’t want to link to the song, in solidarity with my fellow ear-worm sufferers. So thanks a lot, Shulman!
… resisting the urge to click on that song… resisting the urge… resisting the urge… resisting… oh, hell with it!
I think that’s the default, although the docs don’t specify that.
They rarely need massaging, but they often can’t be used as filter literals, since important regexp characters conflict with filter syntax characters. But it’s easy to fix that with let, set, define, procedure, and such:
<$let re = "[\boo]b]">
{{{ [all[tiddlers]search:my-field:regexp<re>] }}}
</$let>
For searching the regexps should be relative straight forward. Learning them IMO depends on the quality of the description. The best I could find is: https://www.regular-expressions.info/ I did learn everything I know about regexps from there.
The important thing is, that you do not read it. You have to work through the examples they give.