Preview not working with Edge

We have a hosted Discourse, and today few people have complained that preview does not work with Edge (at least version 40)

Repro steps:

  • Create a new topic
  • Start writing a message
  • Preview area on the right stays blank (expected: preview shows formatted text as you type)
  • Console displays error message after each character typed, see image


Yep, I can repro on Edge latest.

Microsoft Edge 44.17763.1.0
Microsoft EdgeHTML 18.17763

Not sure when Edge turns into Chrome, looks like “Fall 2019”.


Ok this was kind of tricky to find the root cause, thanks to stellar debugging tools from edge.

So it happens edge has stellar Regexp support (a pattern is emerging) and will result in this:



Making this line of Discourse fail spectacularly.

I was about to write a fix for this case, but @zogstrip found a polyfill, which is probably way better as it will prevent this from happening in any other place in the app.

Thanks for reporting this @MikkoH