Thank you Mark, that works perfectly, but I have realized that it is less adaptable than I initially thought.
I have tried adapting it to filter for only tiddlers tagged with "spam".
I first tried the following with the field "tag-filter=spam" in the section I want to filter:
<<toc-selective-expandable 'Section' sort:"sort[title]]+[tag{!!tag-filter}">>
The problem is that in other sections without a "tag-filter" field the filter becomes "[sort[title]]+[tag[]]" which returns nothing.
I've spent the last hour trying to figure out another way of doing it to no avail. Can you see a way to do this?
Thanks again for your help.