The Good and the Limitations of Github Copilot
&gt; <i>Can help you with Email Validation and API Calls</i><p>It generates a nastily complex regular expression that is hopelessly wrong. Visible at <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=9Pw-Roo_duE&amp;t=404" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=9Pw-Roo_duE&amp;t=404</a>, here transcribed:<p><pre><code>  &#x2F;^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$&#x2F;
</code></pre>
For the local part, it requires [\w-\.]+, which excludes many valid characters like everyone’s favourite, +.<p>For the domain part, it <i>tries</i> to allow IPv4 addresses as well as normal domain labels (not IPv6 addresses, though), but it ends up tangling it up in a way that a human never would, allowing things like [12.34.56.com], [987.654.321.000, example.com] and example.123], while disallowing things like example.studio (the last label only allowing 2–4 letters) and IDN TLDs (which start with xn-- and must allow hyphen and numbers, not just [a-zA-Z]).<p>The author makes no comment on how hideously bad it is, which makes me suspect he didn’t notice, which… yeah, shows the problems of the whole thing.