Grep like function in TW5 possible?

155 views
Skip to first unread message

Ray Vermey

unread,
Feb 21, 2021, 4:54:49 PM2/21/21
to TiddlyWiki
Hi all,

I have an idea, maybe it is alrady there but this is what i just think
I would like a tiddler say John Doe where every line in every tiddler that has John Doe in it will be placed automatically in that John Doe tiddler

Like a grep in Linux, only the lines with John Doe in it.....

Is that possible?

Ray

Mat

unread,
Feb 21, 2021, 5:43:29 PM2/21/21
to TiddlyWiki
If you mean to transclude the full(!) text field content from every text that mentions John Doe, then that is not difficult at all. Even simple.
To extract only those lines is more tricky. Exactly how tricky probably depends on how you define "a line".

<:-)

Ray Vermey

unread,
Feb 21, 2021, 5:50:36 PM2/21/21
to tiddl...@googlegroups.com
Only the line Mat, only the line (begin to <br> so to speak... :-)

Ray

Op zo 21 feb. 2021 om 23:43 schreef Mat <matia...@gmail.com>:
--
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 tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/0b0864be-f3f0-4a56-b804-b8362bfb0b09n%40googlegroups.com.

TiddlyTweeter

unread,
Feb 23, 2021, 4:02:45 AM2/23/21
to TiddlyWiki
Like a grep in Linux, only the lines with John Doe in it.....

Is that possible?

Easy. 

GREP is short for REGULAR EXPRESSIONS ("global regular expression print" ).

TW has a regex operator

There is also a great plugin, Tiddler Commander (see "Snr" Tab), that lets you run regex over any Tiddlers.

Just pointers
TT

Ray Vermey

unread,
Feb 23, 2021, 4:23:09 AM2/23/21
to tiddl...@googlegroups.com
Nice plugin thank you for pointing that out.
What i am looking for however is a way to only display the "lines" that contain the search string.
This plugin shows the titles or the tiddlers... but it is a nice one :-)

Ray

Op di 23 feb. 2021 om 10:02 schreef TiddlyTweeter <Tiddly...@assays.tv>:
--
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 tiddlywiki+...@googlegroups.com.

Mat

unread,
Feb 23, 2021, 5:00:59 AM2/23/21
to TiddlyWiki
Only the line Mat, only the line (begin to <br> so to speak... :-)

So in a listwidget, you'd need to first find all tiddlers that contain the string, probably by using the contains filter operator.
Then extract the text from these, e.g using get[text] filter operator or perhaps [{!!text}]
Then for every point that you define as the beginning or end of the line, use some split operator.
Then search for the string again in each line with a regexp or contains or some such filter operator. 
And that's basically it.

But, beware, I did ask for how you define a "line" because you'll want to capture all cases. 

I suggest you give it a go Ray and you will most likely get support here on the boards.

<:-)


 

Jean-Philippe Rutault

unread,
Feb 24, 2021, 1:55:11 AM2/24/21
to TiddlyWiki
Hello,

Eucaly's matchfilter plugin does the trick and allow to act like a grep. See discussion here https://groups.google.com/g/tiddlywiki/c/ZKPAwN7e-5E/m/yIlgew9FAQAJ

best regards
Reply all
Reply to author
Forward
0 new messages