Good,
 I will see how to adopt it for tw-regexp.

--Mohammad

On Wednesday, August 28, 2019 at 2:43:19 PM UTC+4:30, @TiddlyTweeter wrote:
>
> Ciao Mohammad
>
> For the regex section of *Tiddler Commander *(a slightly hacked version) 
> I wrote a custom macro that loads both "match" & "replace", "flags", 
> "field" etc ... 
> I wanted to add loading of example data  from a Tiddler (non-destructive; 
> i.e. its copied to a temporary Tiddler to work on and discard) but still 
> haven't finished that.
>
> *You might find it useful? At least as a proof. *
>
> Part of the issue we are documenting is how to *"match". *
> We doing well now on that, but still weak on *"replace"*. 
>
> *? ? IMO users may want to use regex when they actually want to CHANGE 
> something ? ?*
>
> code ...
>
> \define snr-regex(match:" ", replace:"""-""", field:"text", case:"i", 
> flags:"g", description:"A Regex")
> <blockquote>
>
> ; $description$
> : field: ''`$field$`''&nbsp;&nbsp; flags: ''`$case$`''&nbsp;''`$flags$`''
> : match: ''`$match$`''
> : replace: ''`$replace$`''
> <$button tooltip="load match and replace patterns">
>    <!-- load match and replace regex via inline macro 
> -------------------------------------------->
>    load
>    <$action-setfield $tiddler="$:/state/commander/snr/select-tiddler/field" 
> text=$field$         />
>    <$action-setfield $tiddler="$:/state/commander/snr/gm"                   
> text=$flags$         />
>    <$action-setfield $tiddler="$:/state/commander/snr/whole-words"          
> text=""              />
>    <$action-setfield $tiddler="$:/state/commander/snr/case-sensitive"       
> text="""$case$"""    />
>    <$action-setfield $tiddler="$:/state/commander/snr/replace-text"         
> text="""$match$"""   />
>    <$action-setfield $tiddler="$:/state/commander/snr/replace-text-with"    
> text="""$replace$""" />
> </$button>
> </blockquote>
> \end
>
> \define snr-regex-apply(match, replace)
> <$button  tooltip="apply this pattern">
>    <!-- apply match & replace regex -->
>    apply / done
>    <$action-setfield $tiddler="$:/state/commander/snr/replace-text"      
> text=""""""     />
>    <$action-setfield $tiddler="$:/state/commander/snr/replace-text-with" 
> text=""""""     />
> </$button>
> \end
>
>
> It looks like this ...
>
> [image: Annotation 2019-08-28 120936.jpg]
>
>
> TT
>
>
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/08c356b9-dde4-4642-a341-2ff8195374a5%40googlegroups.com.

Reply via email to