You're trying to "glue" the result of a transclusion into a string. 
Whenever you need to do that, you almost always need a macro. This worked 
in my quick test:

\define filt() ^$(dt)$10
<$set name="dt" value={{!!title}}>
Number of entries: <$count filter="[regexp:startdate<filt>]"/>
</$set>

HTH
-- Mark

On Saturday, August 18, 2018 at 6:40:12 AM UTC-7, Pin Tail wrote:
>
> I'm trying to transclude the title of a tiddler into a regular expression 
> and can't figure out why it's not working.
>
> I've created a year summary template tiddler, and in a given year, I want 
> to show for each month how many tiddlers have a date (in their startdate 
> date field) in that month. The idea is that the yeartemplate tiddler would 
> be transcluded into a tiddler whose title is simply the year. I want to use 
> a regular expression which combines the title of the transcluding tiddler 
> (i.e. the year) with each month, in order to show a month-by-month 
> breakdown.
>
> So my 2014 tiddler just looks like this:
> {{||yeartemplate}}
>
> And the yeartemplate tiddler, looks like this (focusing just on the month 
> of October here, for brevity). 
>
> <$set name="filt" value="^{{!!title}}10">
> Number of entries: <$count filter="[regexp:startdate<filt>]"/>
> </$set>
>
> However, this doesn't work. I get a count of zero even though I know there 
> are many matching tiddlers. To try and work out what the problem is, I've 
> extended my yeartemplate tiddler to compare the transclusion method with 
> writing out the regexp directly:
>
> <$set name="filt" value="^201410">
> <<filt>>
>
> Number of entries: <$count filter="[regexp:startdate<filt>]"/>
> </$set>
>
> <$set name="filt" value="^{{!!title}}10">
> <<filt>>
>
> Number of entries: <$count filter="[regexp:startdate<filt>]"/>
> </$set>
>
> The results of the above template, when transcluded into a tiddler with 
> the title "2014" are given below:
>
> ^201410 Number of entries: 23
>
> ^201410 Number of entries: 0
>
>
> Even though the "filt" variable which contains the regular expression is 
> identical after transclusion, it doesn't find the matching tiddlers which 
> *are* found when an identical regexp is hard coded. What's going on?
>

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/3591e5c0-fc8a-4745-b9b7-da3b86b42f35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to