See http://tw-regexp.tiddlyspot.com/
to learn how to use regexp in Tiddlywiki. --Mohammad On Thursday, December 12, 2019 at 10:30:31 PM UTC+3:30, Paul Lee wrote: > > I wish I could put a regex in a filter, in order to select all fields > whose identifiers begin with the same group of characters in tiddlers > inheriting one of my templates. > > The needed functionality is to loop through different fields with the same > name except for a number at the end, outputting a phrase before the value > of those fields only if that particular tiddler is present in the child > tiddlers that will transclude the template. The intended purpose is to list > people who are the subjects of photographs; each photograph tiddler has one > or more "subject#" fields containing names. A portrait of John Smith has a > field *subject 1: John Smith*, while an expedition photo of Lewis and > Clark might have *subject1: Meriwether Lewis* and *subject2: William > Clark*. > > Three thoughts about how to do this: > > - A regex in a $list widget, if such a thing were possible: <$list > filter="[all[current]has[subject*[1-9]*]"> > - A *for* loop... I'm guessing this would require a macro? Would I > define the index variable using the *$set* widget? > - The *$fields* widget allows me to approximate what I want to do due > to its useful *template* attribute, but it is difficult to foresee all > the many fields that need to be exlcuded using its *exclude* attribute. > > I saw that there is an escaperegexp operator > <https://tiddlywiki.com/#escaperegexp%20Operator>, but I'm guessing that > this filter notation merely escapes regex strings? > > I don't really understand; I'm not a developer myself, merely a user who > has learned basic JavaScript syntax. > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/4adccdc3-3c3f-4fd9-9ea5-f0ff46d9ec66%40googlegroups.com.

