I have the following regular expresssion
/\<oauth_token\>([^\<]*)\<\/oauth_token\>/
我看到 jsLint 报告了未转义的 < 字符,但不知道原因。请问有人可以给我指点吗?
这个正则表达式被分配给一个变量,并在整个文件中使用。它在一个 nodejs 模块中。
这是一种绕过非标准兼容的 OAUth 响应的方法,未来将会得到修复。我不想引入 XML 解析器作为额外依赖来解决这个问题。
我在 JSHint 和 node-jslint 中都看到了这个违规行为。
您可以在 Github 上看到该文件的完整源代码。JSHint 的精确输出如下:
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.
<script>
标签中吗? - Digital Plane