title: How to use a regular expression in Tkinter text search method?
body: <p>I want to find an area for highlighting within square brackets. These square brackets may contain any text: <code>[A hello world] [B this is a tree] [A tkinter documentation is bad]</code> </p>
  
  <p>I want to highlight the words in the brackets that have "A" character with them, like this:
  <img src="https://i.stack.imgur.com/OWMPX.png" alt="enter image description here"></p>
  
  <p>To get the starting index and the number of the matched characters I tried this:</p>
  
  <pre><code>countVar = StringVar()
  reg_area = re.compile(r'\[A.*\]')
  index = text.search('1.0', reg_area, stopindex=END, count=countVar, regexp = True)
  </code></pre>
  
  <p>This does not work and I receive. </p>
  
  <pre><code>TclError: bad text index "&lt;_sre.SRE_Pattern object at 0x3856d78&gt;"
  </code></pre>
  
  <p>How do I find all occurences and correctly highlight them? </p>