I want to find an area for highlighting within square brackets. These square brackets may contain any text: [A hello world] [B this is a tree] [A tkinter documentation is bad]
I want to highlight the words in the brackets that have "A" character with them, like this:
To get the starting index and the number of the matched characters I tried this:
countVar = StringVar()
reg_area = re.compile(r'\[A.*\]')
index = text.search('1.0', reg_area, stopindex=END, count=countVar, regexp = True)
This does not work and I receive.
TclError: bad text index "<_sre.SRE_Pattern object at 0x3856d78>"
How do I find all occurences and correctly highlight them?