Quandry JSLint Regexp rule violations

I have the following regular expression

/\<oauth_token\>([^\<]*)\<\/oauth_token\>/ 

I see jslint violations for unescaped <characters, but can't figure out why. Can someone enlighten me please?

This regular expression is assigned to a variable and is used throughout the file. It is located in the nodejs module.

This is a hack to get around the non-standard OAUth answer, which will be fixed at some point in the future. I do not want to cite the XML parser as an additional dependency to solve the problem.

I see this violation with both JSHint and node-jslint.

You can see the full source code for the github file. The exact JSHint output looks like this: as follows:

 lib/oauth-helper.js: line 5, col 21, Unexpected escaped character '<' in regular expression. lib/oauth-helper.js: line 5, col 39, Unexpected escaped character '<' in regular expression. lib/oauth-helper.js: line 5, col 44, Unexpected escaped character '<' in regular expression. lib/oauth-helper.js: line 6, col 22, Unexpected escaped character '<' in regular expression. lib/oauth-helper.js: line 6, col 47, Unexpected escaped character '<' in regular expression. lib/oauth-helper.js: line 6, col 52, Unexpected escaped character '<' in regular expression. 
+7
source share
1 answer

There is no need to escape the "<" character in the regular expression. What JSLint tells you is that the backslash in front of your "<" characters in the template is not needed.

+15
source

All Articles