0

The web page not working in the Safari browser and it's working fine on other browsers.

Code

  ngAfterViewInit(): void {
    var ele = document.querySelector('.break-field');
    if (ele) {
      ele.innerHTML = ele.innerHTML.replace(/(?<!\\)\\n|\n/g, '<br/>')
    }
  }

Error Message

[Error] SyntaxError: Invalid regular expression: invalid group specifier name
    promiseReactionJob
BIS Tech
  • 17,000
  • 12
  • 99
  • 148

2 Answers2

0

Looks like Safari does not support lookbehind in regular expressions. Have you taken a look at this?

0

Change regular expression into this .replace(/(?:\\[rn])+/g, "<br/>");

BIS Tech
  • 17,000
  • 12
  • 99
  • 148