Problem with "contains" filter when value has spaces

52 views
Skip to first unread message

Mooglegirl

unread,
Jan 9, 2021, 11:22:37 PM1/9/21
to TiddlyWiki
I have a tiddler with a field called "characters" that contains a comma-separated list of characters relevant to the story written in the tiddler. In this case, the field value is "Nicholas Vaughn, Katherine Vaughn". I'm trying to filter on all tiddlers with the name "Nicholas Vaughn" somewhere in the character field. However, including the space in the "contains" filter's value causes it to break.

This works:
[contains:characters[Nicholas]]

This returns no results:
[contains:characters[Nicholas Vaughn]]

Even just adding the space ("Nicholas ") causes the results to immediately go blank. I've tried surrounding the value with quotes with no success. Is this a bug, or is there something else I need to do?

(For context, I need it to be the full name because I'll be using this in a macro that passes in the full name taken from the character tiddler's title.)

Mooglegirl

unread,
Jan 9, 2021, 11:26:31 PM1/9/21
to TiddlyWiki
Oh, my TiddlyWiki version is 5.1.21. I'm using TiddlyDesktop on Windows.

Eric Shulman

unread,
Jan 10, 2021, 12:02:43 AM1/10/21
to TiddlyWiki
On Saturday, January 9, 2021 at 8:22:37 PM UTC-8 Mooglegirl wrote:
I have a tiddler with a field called "characters" that contains a comma-separated list of characters relevant to the story written in the tiddler. In this case, the field value is "Nicholas Vaughn, Katherine Vaughn".

TiddlyWiki lists are *space-separated*, and use doubled square brackets surrounding values that contain spaces.

Thus, the character field value should be something like this:
   [[Nicholas Vaughn]] [[Katherine Vaughn]]

-e

Mark S.

unread,
Jan 10, 2021, 12:03:03 AM1/10/21
to TiddlyWiki
Note that the contains operator expects a list field. In a list field your entries would be formed like:

[[Nicholas Vaughn]] [[Katherine Vaughn]]

A list field like this has advantages, since it can be easily converted into a title list for use in filters.

What TiddlyWiki was "seeing" would have been more like:

[[Nicholas]] [[Vaughn,]] [[Katherine]] [[Vaughn]]

which is why "Nicholas" matched, but nothing else.

If you want to continue using a comma separated list, probably searching the field with the regexp operator would work.


On Saturday, January 9, 2021 at 8:22:37 PM UTC-8 Mooglegirl wrote:

Mooglegirl

unread,
Jan 10, 2021, 12:08:15 AM1/10/21
to TiddlyWiki
Aha, switching to regexp:characters did the trick! Thanks folks.
Reply all
Reply to author
Forward
0 new messages