且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Javascript Regex指定允许的内容(而不是不允许的内容)

更新时间:2023-01-14 19:48:01

尝试 \ W (大写W)。

\w 选择单词,而 \ W 选择不是字。并且在表达式中看起来更好一些。

The \w selects word, while \W selects not word. And looks a bit nicer in the expression.

这是一个 RegEx cheatsheet ,它在你编码时很方便!

Here's a RegEx cheatsheet, it comes handy while you're coding!