javascript – Microsoft Copilot is unable to write regex on screen

I’m asking Copilot to help write one text processing function in JavaScript, and it keeps outputting it with such broken regexes. And it is little bit hard for me to spot what exact symbols are missing (or aren’t) there. Maybe this is only new lines, but around this [\] sequence it becomes corrupt. Asked it to print all this inside its’ usual text, not inside code box – same thing. And it refused provide it in file. So, I’m only guessing what issue might it be here…

Asking more not to help decode regexes (there are ~3 more like these in different places), but what could be the reason causing this, and how to overcome it, i.e. ask not to use some characters’ sequence, or write it in some other format.

broken regex inside code box

Regex is broken inside plain text too

Read more here: Source link