title: Python Regex - Positive Lookbehind Quantifier Alternative
body: <p>I have this dialog of a play by Shakespeare,What I want to do basically:</p>
  
  <p>insert a colon (:) after every actor name. Thus the dialog becomes like this:</p>
  
  <p><strong>BRUTUS: Bla blah blah</strong></p>
  
  <p><strong>CESAR: Bla blah blah</strong></p>
  
  <p><strong>ANTONY: Bla blah blah</strong></p>
  
  <p>You can see this is not the case as it's shown below:</p>
  
  <pre><code>line_1 = 'CASSIUS Brutus, I misunderstood your feelings, and therefore kept to myself certain thoughts I might have shared. Tell me, good Brutus, can you see your face?'
  
  line_2 = 'Trumpets play. Everyone exits except BRUTUS and CASSIUS .'
  </code></pre>
  
  <p>The dialog is formatted thus:
  The actor name is written <strong>ALL IN CAPS at the beginning of the line</strong>
  For example </p>
  
  <pre><code>line_1 &gt;&gt;&gt; CASSIUS
  </code></pre>
  
  <p>i.e. CASSIUS is the actor here.</p>
  
  <p>However, some lines contain names of actors in the play (not at the beginning of the line) written in upper case format. See line_2.</p>
  
  <p>What is required is a regex expression or a python methodology to insert a colon after every actor name.
  We know the name of the actor by the following two conditions:</p>
  
  <p><strong>1) It is at the beginning of the line.</strong></p>
  
  <p><strong>2) It is written all in uppercase format.</strong></p>
  
  <p>CASSIUS is the actor in line_1 (it meets both conditions).
  However this is not the case for line_2 for BRUTUS and CASSIUS (they are in the middle of the line), hence not colon after their name.</p>
  
  <hr>
  
  <p>Here is my attempt, which applies to the unwanted words BRUTUS and CASSIUS in line_2!</p>
  
  <pre><code>re.sub(r'(?&lt;=([A-Z][A-Z]\b))', ': ', line_1)
  re.sub(r'(?&lt;=([A-Z][A-Z]\b))', ': ', line_1)
  </code></pre>
  
  <p>I get the following output, which is not good!</p>
  
  <pre><code>'CASSIUS:  Brutus, I misunderstood your feelings, and therefore kept to myself certain thoughts I might have shared. Tell me, good Brutus, can you see your face?'
  
  'Trumpets play. Everyone exits except BRUTUS:  and CASSIUS:  .'
  
  </code></pre>