0

I am getting like this error in my application:

The application uses a dangerous regex pattern "/(?:\[rn]|[\r\n]+)+/g", at line 02 line number javascript code.

So How to resolve this vulnerable issue in regular expression? Any alternate method is there?

  var longline = "dddgjjb gah hjjjj \ fghjj hjjjjj"+"Dffjjhk";  
  var test=longline.replace(/(?:\\[rn]|[\r\n]+)+/g, "<br />").replace(/(?:\\+)+/g,"");        // 02 line number 
  console.log(test);

Demo: https://stackblitz.com/edit/js-qdqjz3

Makizh
  • 189
  • 2
  • 9
  • 18

0 Answers0