如何修复jslint消息不安全'。' [英] how to fix jslint message Insecure '.'

查看:76
本文介绍了如何修复jslint消息不安全'。'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jslint报告邮件不安全'。'。

jslint reports message Insecure '.'.

在行

html = /<body.*?>([\s\S]*)<\/body>/.exec(responseText);

如何解决这个问题?

更新

在正文和结束前,可能有属性\ s?不能用。 Javascript在浏览器中运行,使用jQuery。
哪个是从字符串中提取body元素内容而不是这个的最好方法?

After body and before closing bracket there may be attributes so \s? cannot used. Javascript is running in browser, jQuery is used. Which is best way to extract body element content from string instead of this?

推荐答案

你可以试试这样的东西如果你真的希望它匹配所有内容并且不希望jslint错误。

You may try something like this if you really want it to match everything and don't want the jslint error.

var everything = /.*?/;// not jslint acceptable
var all = /[\w\W]*?/;// jslint acceptable

基本上它表示任何单词字符和任何非单词字符......它几乎涵盖了所有内容。

basically it says any word character and any non-word character... which pretty much covers everything.

这篇关于如何修复jslint消息不安全'。'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆