Ciao RunningUtes,

IF what you want to do regex Tiddler Danielo's tool is pretty good, as 
Birthe mentioned. https://danielorodriguez.com/TW5-searchNreplace/

Stephen's also http://skplugins.tiddlyspot.com/#FindReplace, though not 
full regex. Its well integrated into the editor.

IF what you want to do regex that is consistent  and automatic so that its 
always run on a specific type of content, look to BJ's Flexibility plugin 
that defines a Content Type that will always have regex you define applied 
before the main parser kicks in. Its the best IF the input text has a 
standard pattern of transform you need as its automatic once set-up. 
http://flexibility.tiddlyspot.com/

Best wishes
Josiah

On Saturday, 3 February 2018 01:27:38 UTC+1, RunningUtes wrote:
>
> I was thinking that it would be great to have a search and replace 
> function that could be used in tiddlers. I couldn’t find anything already 
> coded, but did find a bookmarlet that looks promising. I would like to have 
> this work only in the opened text area of the tiddler being editied. 
>
> How could this bookmarket be modified? 
>
> Bookmarklet below: 
>
> <pre> 
> javascript:var count=0; 
> function htmlreplace(a,b,element){ 
> if(!element)element=document.body; 
> var nodes=element.childNodes; 
> for(var n=0;n<nodes.length;n++){ 
>    if(nodes[n].type&&nodes[n].type.toLowerCase()=='textarea'){ 
>       var r=new RegExp(a,'gim'); 
>       if(nodes[n].value.match(r)){ 
>         count++; 
>       } 
>       nodes[n].value=nodes[n].value.replace(r,b) 
>     } 
>     else if(nodes[n].nodeValue && nodes[n].nodeValue.length > 0){ 
>       var r=new RegExp(a,'gim'); 
>       if(nodes[n].nodeValue.match(r)){ 
>         count++; 
>       } 
>       nodes[n].nodeValue=nodes[n].nodeValue.replace(r,b) 
>     } 
>     else{ 
>       htmlreplace(a,b,nodes[n]) 
>     } 
>   } 
> } 
> htmlreplace(prompt('find'),prompt('replace')); 
> alert('replaced '+count+' words.'); 
> </pre>

-- 
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 post to this group, send email to [email protected].
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/7df9723e-d343-41c2-af90-c7a8043d7fea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to