[TW5]] Regexp to find tiddlers with a title of max length

72 views
Skip to first unread message

Matthew Petty

unread,
Apr 5, 2018, 8:47:08 AM4/5/18
to TiddlyWiki
The filter operator minlength is very useful, but I really want to find tiddlers with a title of a maximum length, and maxlength doesn't exist. For example to find missing tiddlers with only 4 or 5 character titles, which will most likely be abbreviations.

What would the filter for that be? I've tried 
regexp[\w{1,4}$]
but it doesn't work. I think what I need is to find tiddlers with a title between 1 and 4 characters, and "\w" is any alphanumeric character.

Stephan Hradek

unread,
Apr 5, 2018, 10:07:34 AM4/5/18
to TiddlyWiki
I do not completely understan your question.

But this is an explanation for regexp:

  • [\w{1,4}$]
    •   This would match almost ANY title, because you say: Find 1-4 characters at the end of the title.
  • [^\w{1,4}$]
    • This would match titles having 1-4 characters

Matthew Petty

unread,
Apr 7, 2018, 1:15:22 PM4/7/18
to TiddlyWiki
I had missed out the ^, so that fixed it, thank you!

To explain what I'm doing, just in case you're interested, I have a table of missing tiddlers, with a set of checkboxes for common tags. This filter will find the short ones that might be more likely to be tagged "abbreviation".

(of course, is it valuable to create empty tiddlers just to have fewer missing tiddlers? debatable)

Luca Dorigo

unread,
Apr 9, 2018, 2:17:40 AM4/9/18
to TiddlyWiki
(you probably know it, but if you want /any/ character and not only alphanymeric ones, it should be /^.{1,4}$/ :-) )
Reply all
Reply to author
Forward
0 new messages