I am trying to clear Javascript code using jshint. In a third-party script that is used, jshint complains about unescaped javascript in this line:
var cleanString = deaccentedString.replace(/([|()[{.+*?^$\\])/g,"\\$1");
I would also like to understand what this regular expression does, but I don't see it. Can someone tell me what it is for and how to write it on a cleared path?
Thanks for any tips.
It matches any of the following characters: |()[{.+*?^$\and replaces it with its escaped instance (backslash plus this character).
|()[{.+*?^$\
regex [ , , :
[
var cleanString = deaccentedString.replace(/[|()\[{.+*?^$\\]/g,"\\$0");
( .)
"" . , "[" , . :
var cleanString = deaccentedString.replace(/([|()\[{.+*?^$\\])/g,"\\$1");
, , - , jshint; , , , : -)