title: Is there a case where "[^xy]" is not equal to "(?!x|y)."?
body: <p>I'm working on my own JavaScript library to support new metacharacters and features for regular expressions, and I'd like to find a case where <code>[^xy]</code> is not equivalent to <code>(?!x).</code> (or more specifically <code>(?:(?!x|y).)</code>).</p>
  
  <p>Take the example text: <code>"abc\n"</code></p>
  
  <p>Say I want to emulate a Perl regex: <code>/\A.{3}\Z/s</code></p>
  
  <p>With the singleline flag, the JavaScript regex should be equivalent to: <code>/^[\s\S]{3}\n*$(?!\s)/</code> (<code>\A</code> becomes <code>^</code>, <code>.</code> becomes <code>[\s\S]</code>, <code>\Z</code> becomes <code>\n*$(?!\s)</code>)</p>
  
  <p>Now, <code>/^.{3}$/</code> would fail, but <code>/^[\s\S]{3}\n*$(?!\s)/</code> would capture "abcabc" (same as the Perl regex)</p>
  
  <p>Since <code>\Z</code> contains more than just a metacharacter, emulating <code>[^\Z]</code> would seem to be more difficult.</p>
  
  <p>Take the example text: <code>"abcabc\n"</code></p>
  
  <p>The proposed JavaScript regex for the Perl regex <code>/.{3}[^\Za]/g</code> would be <code>.{3}(?:(?!\n*$(?!\s)|a).)/g</code></p>
  
  <p>Both will match <code>"bcab"</code></p>
  
  <p>So, finally, I pose the question again. Is there a case where <code>[^xy]</code> is not equivalent to <code>(?:(?!x|y).)</code> with such a scenario, perhaps in a more complex regular expression where a lookahead would change the scenario?</p>