#4) Search and Replace on steroids
One of the most common editing activities is searching and replacing text, but searching and replacing rich text can be a bit more tricky. Should everything you can see be searched and replaced, including the labels on buttons, the titles in sections, and the caption on graphics, or should only the "pure text" be searched? What about the rich text you cannot see, such as action hotspots, URLs in URL links, hide formulas and that sort of thing? In the Midas Rich Text LSX, we think you need the power to search and replace in all of these contexts, but the flexibility and control to pick and choose. If you want to replace a fieldname used in hide-formulas, but nowhere else, you can do it. If you want to change a server name hardcoded into URL links, you can do that.
In addition, sometimes you know the exact search string and the exact replacement string, but sometimes you only know a rough pattern. For those times, the Midas Rich Text LSX will match simple wildcard patterns in your text and replace those with a specified string.
And beyond that, sometimes you don't know what the replacement string should be at all, but want a process to determine the string based on various factors, such as what the actual string found was in a wildcard pattern or the user who is doing the replacement. In those cases, the Midas Rich Text LSX can trigger an event which will allow you full control over the replacement string based on the search string and whatever else you want.
In 1997, for Notes R4.1, the Midas Rich Text LSX was introduced, and in the original set of features was search and replace with wildcards and events on demand. In 1998, the ability to search non-text strings was added, still for R4.1 and up. It was not until 2002, with Notes/Domino 6.0, that IBM added even the simplest form of search and replace to its rich text classes, and even then without any of the specialized features Midas has. Even in 2006, with Notes/Domino 7.0, there is no support for wildcards or pattern matching, no support for changes to anything other than pure text, and no ability to control the replacement based on events, formulas or scripts.
Oh yes, and speaking on search and replace on steroids, with that first release of Midas in 1997, we also released the LinkMatching method, which allows you to search for any string represented by a document in a view and replace it with a link hotspot back to the found document. This was later enhanced, in 2003, to add the AppendMatching, InsertMatching, ReplaceMatching, KeywordMatching and PopupMatching methods, to further extend the idea of search and replace.
Comparison with standard Notes/Domino functionality
It was not until 2002, five years after Midas introduced pioneered search and replace technology in LotusScript, that with Notes/Domino 6.0 IBM added even the simplest form of search and replace to its rich text classes, and even then without any of the specialized features Midas has. Even in 2006, with Notes/Domino 7.0, there is no support for wildcards or pattern matching, no support for changes to anything other than pure text, and no ability to control the replacement based on events, formulas or scripts. Notes/Domino also still has nothing like the LinkMatching and other SmartRefs functionality.
The documentation on search and replace technology is mostly found in the Midas Help database under the ReplaceText method, the UserReplaceText method (for events) and in the LinkMatching and other method descriptions.
Search & Replace: Allows you to search for and replace simple words and phrases or wild card expressions, either with your own or with a standard content.
Jose's Keyword Replacement - Example shows how to replace keywords in a rich text field with rich text segments (images, stylized text, etc.) as would be used in a document assembly or mail merge type application. Midas Editing - Example shows a variety of methods used to edit existing text, including search and replace with wildcards and dynamic link creation with links created in text and around graphics. Replace URLs - This sample shows different ways to modify or replace URL's in URL hotspots both in rich text fields and in design elements such as pages and forms.
Sample Script Snippet
This snippet would replace every instance of the string LeadArbitrator with the string Leader in any hide-when formulas anywhere in the rich text.
Set rtitem = New GeniiRTItem
Call rtitem.ConnectBackend(doc.Handle, "Body")
If rtitem.IsConnected Then
Call rtitem.Everything.ReplaceText("LeadArbitrator", "Leader", "HIDE_FORMULA");
If rtitem.Modified Then rtitem.Save
Weblog Posts on Search and Replace
Copyright © 2006 Genii Software Ltd.