Trying to include search and replace in a tiddler - how to use global and ignore?

65 views
Skip to first unread message

Riz

unread,
Dec 21, 2017, 9:13:59 PM12/21/17
to TiddlyWiki
Pardon my low javascript-fu. I was scraping up a editor toolbar button to search and replace strings in that particular tiddler. I got till

/*\
title: $:/core/modules/editor/operations/text/findandreplace.js
type: application/javascript
module-type: texteditoroperation

Text editor operation to find and replace from the entire text

\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

exports["replace-search"] = function(event,operation) {
	operation.cutStart = 0;
	operation.cutEnd = operation.text.length;
	operation.replacement = operation.text.replace(event.paramObject.search, event.paramObject.replace);
};

})();



which lets me achieve it, but only one instance at a time. My attempts to use global and ignore-case at event.paramObject.search as well as the actual search string has so far ended up in failure.

I guess it will be a 10 second task for anyone with slightly more than beginner js knowledge.


Birthe C

unread,
Dec 21, 2017, 11:06:36 PM12/21/17
to TiddlyWiki
Did you see Stephen Kimmels http://skplugins.tiddlyspot.com/#FindReplace or maybe Danielo Rodriguez https://danielorodriguez.com/TW5-searchNreplace/


Birthe

Riz

unread,
Dec 21, 2017, 11:12:10 PM12/21/17
to TiddlyWiki
Oops, my bad. Thanks!!
Reply all
Reply to author
Forward
0 new messages