How to match a partial tag with fET

14 views
Skip to first unread message

whatever

unread,
Feb 4, 2011, 2:21:54 PM2/4/11
to TiddlyWiki
Hi!
Is there a way to match a partial tag with fET? For example, I have
tags like [[born 1978]], [[born 1985]], [[born 1991]] and so on and
I'd like to check if the tiddler contains a tag that contains "born".
There are too many years and they're not sequential. I tried
incorporating the match function and using a regular expression
(match(/born \d*/)), but I keep getting an error.
Any ideas?
w

whatever

unread,
Feb 4, 2011, 2:22:41 PM2/4/11
to TiddlyWiki

cmari

unread,
Feb 4, 2011, 2:49:49 PM2/4/11
to TiddlyWiki
Hi w,
You might try:
<<forEachTiddler where
'tiddler.tags.sort().join("]]").contains("born")'>>
though that, I think will get you any tiddler whose tags contain the
letters "born" (anywhere).
I'd be curious to hear if there is a way to look for tags that start
with a certain letter or combination of letters.
cmari

whatever

unread,
Feb 4, 2011, 3:20:15 PM2/4/11
to TiddlyWiki
Yes, that did the trick, although I omitted ".sort()".
Thanks,
w

Måns

unread,
Feb 4, 2011, 4:15:55 PM2/4/11
to tiddl...@googlegroups.com
Hi cmari and whatever

Yes, that did the trick, although I omitted ".sort()".
What does sort do in this instance?
I don't see any difference in the output..

Cheers Måns Mårtensson 

whatever

unread,
Feb 4, 2011, 4:33:28 PM2/4/11
to TiddlyWiki
The sort() function sorts the tags, however, in my case, that is not
necessary, since it doesn't matter where the string is, I'm merely
checking for its presence.

w

Måns

unread,
Feb 4, 2011, 6:34:52 PM2/4/11
to tiddl...@googlegroups.com
Hi whatever

The sort() function sorts the tags, however, in my case, that is not
necessary, since it doesn't matter where the string is, I'm merely
checking for its presence.
 
Thanks for answering my simple question. 
How do you make it sort by tiddler.title to uppercase? 

Cheers Måns Mårtensson

whatever

unread,
Feb 5, 2011, 2:11:06 AM2/5/11
to TiddlyWiki
<<forEachTiddler where 'YourCondition' sortBy
'tiddler.title.toUpperCase()'>>
Just replace YourCondition with your own parameters. You can also use
toLowerCase() to sort, however, I'm not sure what the difference is,
if any.
w

Måns

unread,
Feb 5, 2011, 6:30:02 AM2/5/11
to tiddl...@googlegroups.com
Hi Whatever

Thanks, this works fine:

<<forEachTiddler where 'YourCondition' sortBy
'tiddler.title.toUpperCase()'>> ...
 
 Cheers Måns Mårtensson
Reply all
Reply to author
Forward
0 new messages