Am Montag, 12. Februar 2018 17:24:48 UTC+1 schrieb PMario:
>
> Is it possible to have several capturing groups?
>

I think I found a good solution.


   1. filter "pick:field[regexp]"
   Will pick every captured group as a new tiddler. If there is no group it 
   acts exactly like regexp
   2. filter "pickgroups:field[regexp]"
   Will capture every group into one tiddler, joined with character \x00, 
   thus making it usable by
   3. widget "splitgroups"
   which will split the <<currentTiddler>> at character \x00 into a set of 
   variables, possibly "sweetened" by some text

Examples

Exampletiddler contains
Auf der Mauer, auf der Lauer sitzt 'ne kleine Wanze

First example
<$list filter="[pick:text[auf der (\w+)]]"/>

will return "Lauer" - as "auf" doesn't match "Auf"

Second example
<$list filter="[pick:text[(?i)auf der (\w+)]]"/>

will return "Mauer" - as "auf" now matches "Auf" and we didn't use global 
search

Third example
<$list filter="[pick:text[(?gi)auf der (\w+)]]"/>

will return "Mauer" and "Lauer" - as we did a case-insensitive global search

Fourth example
<$list filter="[pick:text[(?i)auf der \w+]]"/>

will return "Exampletiddler" - as we have no capturing group and so the 
title is returned.

Fifth example
<$list filter="[pick:text[(?i)(auf der) (\w+)]]"/>

will return "Auf der", "Mauer", "auf der" and "Lauer". Each one as a 
seperate tiddler

Sixth example
<$list filter="[pickgroups:text[(?i)(auf der) (\w+)]]">

<$splitgroups a="a: $1" b="b: $2">
<<a>>, <<b>>
</$splitgroups>
</$list>

will return

"a: Auf der, b: Mauer"
and
"a: auf der, b: Lauer"


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/ce106a6a-07d6-4c13-9a97-3424d7c8ba91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to