I am trying to find a way to match whole words using the Tkinter Text
search method, but I have not found a consistent way of doing it. I have tried to set regexp
to True
and then use word boundaries of the Tcl
regular expressions, with y
wrapping the word:
pos = text_widget.search('\y' + some_word +'\y', start, regexp=True)
It seems to work, but I think there might exist another way of doing it.
See Question&Answers more detail:os