title: sed - Back reference on match pattern does not work
body: <p>I need to find in files (xml) date in this format <code>2021-06-25T21:17:51Z</code> and replace them with this format <code>2021-06-25T21:17:51.001Z</code></p>
  <p>I thought about using regexp with <code>sed</code> but back references does not work.</p>
  <p>1.xml could look like this, but I have much more fields in those files, and I got fields already correct.</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;Doc&gt;
     &lt;PUB_DATE&gt;2021-06-25T21:17:51Z&lt;/PUB_DATE&gt;&lt;!-- to change --&gt;
     &lt;DATE_COLLECT_100&gt;2021-06-25T21:17:51Z&lt;/DATE_COLLECT_100&gt;&lt;!-- to change --&gt;
  
     &lt;DATE_CREATION&gt;2021-06-25T21:17:51.001Z&lt;/DATE_CREATION&gt;&lt;!-- keep it like this --&gt;
  &lt;/Doc&gt;
  </code></pre>
  <p>Desired output is</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;Doc&gt;
     &lt;PUB_DATE&gt;2021-06-25T21:17:51.001Z&lt;/PUB_DATE&gt;&lt;!-- to change --&gt;
     &lt;DATE_COLLECT_100&gt;2021-06-25T21:17:51.001Z&lt;/DATE_COLLECT_100&gt;&lt;!-- to change --&gt;
  
     &lt;DATE_CREATION&gt;2021-06-25T21:17:51.001Z&lt;/DATE_CREATION&gt;&lt;!-- keep it like this --&gt;
  &lt;/Doc&gt;
  </code></pre>
  <p>Here is my <code>sed</code></p>
  <pre class="lang-sh prettyprint-override"><code>$ sed -Ee 's#&lt;(PUB_DATE|DATE_COLLECT_100){1}&gt;([[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}T[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2})Z&lt;/\1&gt;#&lt;\1&gt;\2.001Z&lt;/\1&gt;#' 1.xml
  </code></pre>
  <p>The regexep seems to be OK in <a href="https://regex101.com/r/phApi9/1" rel="nofollow noreferrer">regex101</a></p>
  <p>Here a representation of it made with <a href="https://regexper.com/#%3C%28PUB_DATE%7CDATE_COLLECT_100%29%7B1%7D%3E%28%5Cd%7B4%7D-%5Cd%7B2%7D-%5Cd%7B2%7DT%5Cd%7B2%7D%3A%5Cd%7B2%7D%3A%5Cd%7B2%7D%29Z%3C%5C%2F%5C1%3E" rel="nofollow noreferrer">https://regexper.com</a>
  <a href="https://i.stack.imgur.com/4EBol.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4EBol.png" alt="representation of the regexp" /></a></p>
  <p>Is back references allowed in sed when they are used in the search portion ?
  Am I missing something about <code>sed</code> ?
  Is there a bug ?</p>
  <p>Sed version : well... I dont know, <code>sed --version</code> <code>sed -v</code> <code>man sed</code> doesn't give it. I'm on OSX.</p>