<html>
    <head>
      <base href="https://bugzilla.gnome.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Problem with apostrophe in URL"
   href="https://bugzilla.gnome.org/show_bug.cgi?id=448044#c8">Comment # 8</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Problem with apostrophe in URL"
   href="https://bugzilla.gnome.org/show_bug.cgi?id=448044">bug 448044</a>
              from <span class="vcard"><a href="page.cgi?id=describeuser.html&login=egmont%40gmail.com" title="Egmont Koblinger <egmont@gmail.com>"> <span class="fn">Egmont Koblinger</span></a>
</span></b>
        <pre>Created <span class=""><a href="attachment.cgi?id=365673&action=diff" name="attach_365673" title="v0">attachment 365673</a> <a href="attachment.cgi?id=365673&action=edit" title="v0">[details]</a></span> <a href='review?bug=448044&attachment=365673'>[review]</a>
v0

Here's a draft patch that seems to be working.

It's based on the 3rd approach. At the beginning there's a named capturing
group APOS_START with a lookbehind to see whether there's a leading apostrophe.
The whole thing is made optional because we mustn't bail out if there isn't.

At the end, lookbehind + backtracking cannot work because backtracking works on
the level of regex blocks, not individual characters. A single backtracking
step decides to omit the whole optional URLPATH. Maybe the regex could be
reworked so that it works, but doesn't look easy.

Instead, luckily, we already define a different set of characters that can
terminate the path (to exclude dot and comma, and I even sneaked in semicolon
here yesterday). The path needs to end in one like this, unless it ends in a
closing parentheseis or square bracket (or is empty), in which case we don't
care about apostrophe here at all.

So here we branch on whether the optional opening apostrophe's named capturing
group matched or not, and depending on that, we forbid or allow the apostrophe.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>