title: Make grep colour only capture groups
body: <p>How do I only <strong>colour</strong> text in <strong>grep</strong> that has been matched by a <strong>group</strong>?</p>
  
  <p>Example:</p>
  
  <pre><code>printf "Jon Skeet" | grep -P "Sk(.)(?:\1t)"
  </code></pre>
  
  <p>Prints out "Jon <strong>Skeet</strong>" (with "Skeet" coloured).</p>
  
  <p>I want it to colour only the first 'e' (ie. "Jon Sk<strong>e</strong>et").</p>
  
  <p><br></p>
  
  <p><strong>EDIT</strong>:</p>
  
  <pre><code>printf "zazbzcz" | grep -P "(.)((?&lt;=.)\1){3}"
  </code></pre>
  
  <p>prints out nothing, but how can I have it print out</p>
  
  <p><strong>z</strong>a<strong>z</strong>b<strong>z</strong>c<strong>z</strong></p>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>Perhaps I wasn't clear.</p>
  
  <p>This will be run in a script where I want it to highlight as follows (therefore I will not know where and which letter or number it will be):</p>
  
  <p><strong>s</strong>d<strong>s</strong>f<strong>s</strong>i<strong>s</strong>j</p>
  
  <p>asd<strong>l</strong>w<strong>l</strong>xa<strong>l</strong>e<strong>l</strong>doxwy</p>
  
  <p>pqk<strong>5</strong>z<strong>5</strong>x<strong>5</strong>c<strong>5</strong>w<strong>5</strong>qas</p>
  
  <p>Note: it will always be exactly one character that needs to be highlighted<br>
  (in an ambiguous case, any of them may be highlighted)</p>