Scintilla in Xojo with Search and Replace

Several people asked for this, so let us add a search feature to our example project. Beside of using ScintillaControlMBS control to show HTML, MySQL or Xojo code, the example now includes a find and replace window:


In Scintilla you not just have a current selection (actually multiple), but also a target range. The target range is used to search and replace text without the user seeing this. We also have a FindText() function to perform a search and return the range where text is found. So you can search and show it in user interface.

Search can be done with various flags:

Option Description
kFindOptionNone Default setting is case-insensitive literal match.
kFindOptionMatchCase A match only occurs with text that matches the case of the search string.
kFindOptionWholeWord A match only occurs if the characters before and after are not word characters as defined by WordChars property.
kFindOptionWordStart A match only occurs if the character before is not a word character as defined by WordChars property.
kFindOptionRegExp The search string should be interpreted as a regular expression. Uses Scintilla’s base implementation unless combined with kFindOptionCxx11RegEx to use C++11 version.

When Regular expressions are enabled, you can use the familiar syntax and use \0, \1, \2 and so on in replacement to reference the Nth captured value.

Please try this in the next pre-release.

4 Likes

Please try in 22.1:
MonkeyBread Software Releases the MBS Xojo Plugins in version 22.1