Sidebar

How to get around insecure warning when using dot (.) character in a regex

0 votes
887 views
asked Apr 9, 2014 by rich-c-2789 (16,180 points)

I have a regex like below to split text into equal parts but qie displays this warning:  line 1 col 48 - insecure '.'. 

var partsArray = 'abcdefghijklmnopqrstuvwxyz'.match(/.{1,6}/g);

The above code is valid and runs successfully.  How can I get arround this warning so that I can see if the rest of the code has valid syntax?

commented Jul 8, 2015 by js-6370 (360 points)
I just tried using the /*jshint regexp: false */ option and I get the following warning:

Bad option value.
Bad option: 'false'.

2 Answers

0 votes
 
Best answer

You can also trun off the inspection using:

/*jshint regexp: false */
var test = 'abcdefghijklmnopqrstuvwxyz'.match(/.{1,6}/g);

Also see this related question:

https://www.qvera.com/kb/index.php/62/can-i-disable-inspections-in-qie?show=62#q62

answered Apr 11, 2014 by rich-c-2789 (16,180 points)
selected Sep 24, 2014 by michael-h-5027
0 votes

Replace this:

var partsArray = 'abcdefghijklmnopqrstuvwxyz'.match(/.{1,6}/g);

With this:

var partsArray = 'abcdefghijklmnopqrstuvwxyz'.match(/[\w\W]{1,6}/g);

 

answered Apr 9, 2014 by rich-c-2789 (16,180 points)
...