I'm trying to get the iters for a specific occurrance of a word in a textbuffer. However, if the word occurs more than once in the buffer, how do I know if I'm getting the iters for the specific occurrance of the word that I want?
In the following code, I have a function that steps through a buffer one word at a time, and a function that gets the selection bounds of the word. Again, how do I know if I'm getting the selection bounds for the correct occurrance of the word, if the word occurs more than once in the buffer?
def split_buffer(self, buff):
"""Step through buffer one word at a time"""
buff = re.split('\s', buff, maxsplit=1)
word, buff = buff, buff
word, buff = buff, None
return word, buff
def get_text_iters(self, buff, word):
"""Get iters for word"""