Reputation: 3253
I have performance problems with ng-pattern on a textarea input.
I have a Regex expression to simply check if the code contains script, image or iframe tag. If I paste a script with multiple lines, after a certain size the entire input and page becomes unresponsive. At a certain point the entire browser tab dies.
Regex:
/^.*(<(img|iframe|script)( [^<]*)*>).*/m
Stackblitz for reproduction: https://stackblitz.com/edit/angularjs-btrpfi?file=home%2Fhome.html
Code I currently pass for testing:
<!-- Begin test script -->
<script type="text/javascript">
var test = 123;
var b = 24;
var c = 22;
var f = 56;
Steps to reproduce: Just add more lines and random content - doesn't really matter.
Any ideas how to get the multi line regex running? I'm aware in this simple case I can use a different approach to check for the tag inclusion compare to the multi-line regex approach, the original setup is a little more complex.
Upvotes: 0
Views: 77