The specified regular expression is interpreted tcl, not python.
Tcl uses a different syntax for word boundaries: \yinstead \b. (See Word boundaries , especially the Tcl part of Word Boundaries.)
The line should be replaced by:
index = self.text.search(r'\y%s\y' % myWord, INSERT, backwards=True, regexp=True)
source
share