Skip to main content
added 15 characters in body
Source Link
Kobi
  • 137.9k
  • 2
  • 38
  • 39

The client-side code causing the error is a regex looking for 2-3 dashes and a space:

e=e.replace(/---?(\s)/g,"—$1")

It can be corrected to also require a space before the dashes:

e=e.replace(/(\s)---?(\s)/g,"$1—$2")

This will also resolve cases like i--.

From a quick check in the data explorer, it looks like in most people do place spaces on both sides for emdashes: https://data.stackexchange.com/stackoverflow/query/edit/730462

The code causing the error a regex looking for 2-3 dashes and a space:

e=e.replace(/---?(\s)/g,"—$1")

It can be corrected to also require a space before the dashes:

e=e.replace(/(\s)---?(\s)/g,"$1—$2")

This will also resolve cases like i--.

From a quick check in the data explorer, it looks like in most people do place spaces on both sides for emdashes: https://data.stackexchange.com/stackoverflow/query/edit/730462

The client-side code causing the error is a regex looking for 2-3 dashes and a space:

e=e.replace(/---?(\s)/g,"—$1")

It can be corrected to also require a space before the dashes:

e=e.replace(/(\s)---?(\s)/g,"$1—$2")

This will also resolve cases like i--.

From a quick check in the data explorer, it looks like in most people do place spaces on both sides for emdashes: https://data.stackexchange.com/stackoverflow/query/edit/730462

Source Link
Kobi
  • 137.9k
  • 2
  • 38
  • 39

The code causing the error a regex looking for 2-3 dashes and a space:

e=e.replace(/---?(\s)/g,"—$1")

It can be corrected to also require a space before the dashes:

e=e.replace(/(\s)---?(\s)/g,"$1—$2")

This will also resolve cases like i--.

From a quick check in the data explorer, it looks like in most people do place spaces on both sides for emdashes: https://data.stackexchange.com/stackoverflow/query/edit/730462