Grepping for portions of text using regular expressions

Hi,

i have the following text where i want to grep the greenish highlighted portions out. As far i can see, there is no “easy-to-use” TW5 builtin-filter that returns the regexp-groups (the used regexp is (\\procedure.*?\\end) in the depicted example):

Basically i want to receive two entries in the filter including the \n's.

The example string on the picture is:

\procedure abc()
bla
\end

function func() jjj

\procedure kkk()
bli
\end

Thanks for any help or doc-pointers!

What’s the purpose of those filters? What do you try to achieve as an end result?

TW wikitext is not designed to be used that way. With functions regexps are doable but the code will get complex.

The purpose basically is just “find” things inside arbitrary text using regexp. There are many functions that somehow “cut” things using regexps but i was wondering if there is nothing that really greps for.

So your answer tells me at least that there are no builtin functions that i didn’t see :wink: . An according JS-filter like [find[regexp]] is easy to build, so i will go that way here.

What i’m trying to achieve? In the concrete example above 'm playing around a little bit with an idea of a type-system including component-based view-approaches within TW5.
But a general drawback with TW currently is: if one transcludes in complexer architectures, it will become problematic at certain points that you don’t know within which exact template-tiddler you are currently “operating” (when rendering contents in some tiddler-stage). So currentTiddler loses its value and there is no means of currentTemplate or something. So access to the currentTemplate's fields (which in some cases may contain needed information) is not possible anymore. Therefor i’m evaluating a func/proc/wid approach with namespacing that provides needed contextual configuration via variables that are then stored inside functions etc. within the text-field of the currentTemplate itself. That basically works for me, even if it still needs to be “polished” architecture-/understandability-wise.

But to make them available to the config-UI (for easy and nice usability) i need a way to read that config-information (that is provided within the mentioned func/proc/wid) and display it to the user. Currently i’m trying to sync fields forth and back from the text of the configuration-tiddler to some of its fields. By that i could then create simple and nice UI-elements in a classic TW5-fashion.

Anyways, wouldn’t a [find[regexp]] be generally handy for TW5?

Perhaps this custom operator (which I recommend renaming to something more distinct from regexp)?

Alternatively, you could use some combination of regexp and split or splitregexp to write a custom filter operator as a function. If you can provide some more examples of the sorts of input/output you’d like (ideally not as screenshots), I’m sure someone here can help.

It sounds like you’re looking for <<thisTiddler>>.