V5.4.0: fields with parentheses in their names

In v5.3.8 and earlier filters did not have a problem with fields with parentheses in their names. E.g.,

[regexp:_cd-work(s)[(?i)suite]]

worked flawlessly.

In v5.4.0 this no longer works:

I will be probably be warned against using parentheses, etc. in field names, but as mentioned, this used to work in versions prior to version 5.4.0. Also, according to https://tiddlywiki.com/#TiddlerFields field names may contain any combination of characters.

(Luckily, when I wrote my music player, I also wrote some simple metadata tools for editing (copying, deleting, setting, etc.) fields in (filtered) lists of tiddlers.)

Is it possible that this new behaviour is caused by the addition in v5.4.0 of new syntax, in particular parentheses, for multi-valued variables?

@Jan - Thanks for your report. I can replicate the problem. Probably an issue with multi-value-variables MVV parsing in filters.

@jeremyruston @saqimtiaz … This is a blocking regression for v5.4.1

I did create an issue at github: [Report] _cd-work(s) field does not work in v5.4.0 · Issue #9865 · TiddlyWiki/TiddlyWiki5 · GitHub

Yes and no, the characters available were expanded to include most characters some time ago.

It does make sense with the introduction of Multi-valued variables this may have side effects in filters, hopefully this will be addressed in 5.4.1 but I would also like to propose a workaround and a better design pattern. Your use is a particularly difficult because you are accepting manual input, and using this in a filter.

I started to work though providing you a work around and tips until this is resolved, but there is a few complications, that can be overcome. However it makes answering a chore. So if you ask I can give some tips, but until then I will put it aside.

Just one tip - why not accept _cd-work(s) and suit as separate values and compose the filter to be used through the use of backtick attributes?

Thanks for your helpfulness, TW_Tones.

The example shown was part of a more complex filter for searching CDs.

I replaced _cd-work(s) with _cd-works (and similarly renamed other fields whose names contained parentheses) using tools I wrote at the time to simplify metadata editing:

@Jan … We did just close the issue and the related PR as a not-planned and incompatible change in v5.4.0

We will need to document this behaviour.

The main problem is, that the “fix” did introduce quite some complexity to the filter parser.

And the fix itself only “solved” this single edge case. So it is no generic solution for future similar problems.

So changing your field names was the right decision.