python - Search tkinter text widget contents using regular expression -


In the tkinter text widget , how do I search the following syntax for a whole word? Tried to use, but it does not match anything, although the word already exists:

  index = self.text.search (r '\ b% s \ b'% myWord , INSERT, back = true, regexp = true)  

Any hint?

By specified standard expression tcl , python Not done by

Use different syntax for the Tcl term boundary: y instead of \ \ b (see, especially TCL word limits section.)

The line should be replaced with:

  index = self.text.search (r) '\ Y% s \ y' % MyWord, INSERT, Back = true, regexp = True)  

Comments