title: Why isn't sed/awk capturing groups the way my regex says it should?
body: <p>I've got a regex here that works according to the site:</p>
  <p><a href="https://regex101.com/r/doj4We/1" rel="nofollow noreferrer">https://regex101.com/r/doj4We/1</a></p>
  <p>regex: <code>&lt;&lt;act (&quot;([^&quot;\\]|\\.)*&quot;)</code></p>
  <p>text:</p>
  <pre><code>&lt;&lt;act &quot;want&quot; &quot;don't want&quot;&gt;&gt;&lt;&lt;/act&gt;&gt;
  
  &lt;&lt;act &quot;\&quot;want\&quot;&quot; &quot;don't want&quot;&gt;&gt;&lt;&lt;/act&gt;&gt;
  </code></pre>
  <p>Group 1 is supposed to capture &quot;want&quot; and &quot;\&quot;want\&quot;&quot;, respectively, and according to the site, it does.</p>
  <p>But if I take this text and save it in a file, then execute this command:</p>
  <pre><code>cat tmp | sed -Ern 's/&lt;&lt;act (&quot;([^&quot;\\]|\\.)*&quot;)/\1/p'
  </code></pre>
  <p>This is the output:</p>
  <pre><code>&quot;want&quot; &quot;don't want&quot;&gt;&gt;&lt;&lt;/act&gt;&gt;
  &quot;\&quot;want\&quot;&quot; &quot;don't want&quot;&gt;&gt;&lt;&lt;/act&gt;&gt;
  </code></pre>
  <p>Why is sed behaving differently from the way this website says it should? I noticed the same problem when I tried to use awk's gensub like this:</p>
  <pre><code>cat tmp | awk '{ r = gensub(/&lt;&lt;act (&quot;([^&quot;\\]|\\.)*&quot;)/, &quot;\\1&quot;, &quot;g&quot;); print r;}' 
  </code></pre>
  <p>For what it's worth, I'm using cygwin.</p>