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

3
  • It would greatly help your question to add a description about what the regex is supposed to be doing. Commented Aug 10, 2020 at 5:07
  • Try this snippet var test=longline.replace(/(?:\\[rn]|[\r\n]+)+/g,''); - The problem is due to putting regex inside double quotes. Commented Aug 10, 2020 at 5:09
  • @user2932057: Not working..again i am getting same issue Commented Aug 10, 2020 at 5:22

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.