Is there a way to make JSLint happy with this regex?

蹲街弑〆低调 提交于 2019-12-01 21:14:18

That's a character class; you don't need a separator (eg: the commas). You can clean up the regex by placing the caret (^) and the dash (-) in strategic positions so they don't need to be escaped.

/[!@#$%^&*?_~()-]/

Should work. You can also use the non-word character class:

/\W/

That matches anything that's not a letter (a-zA-Z), number (0-9) or underscore (_).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!