简体   繁体   English

除了这组字符,还匹配其他任何内容吗?

[英]Match anything but this group of characters?

I'm looking for a pattern that will match anything but this: 我正在寻找一个可以匹配任何东西的模式,但是:

"/[a-z0-9]/i"

How can i do that? 我怎样才能做到这一点?

With ^ , which negates a character set. 使用^ ,它否定字符集。

You want /[^a-z0-9]/i . 您想要/[^a-z0-9]/i

[az] matches a..z. [az]匹配a..z。 [^az] matches anything not a..z. [^az]匹配 a..z的任何内容。

/[^a-z0-9]/i

The ^ at the start inside a [ ] means "none of these" rather than the conventional "any of these" [ ]内开头的^表示“这些都不是”,而不是常规的“其中任何一个”

If he wants something matches not a-z0-9 one time, this is it. 如果他希望某件事与a-z0-9一次不匹配,那就是。 this matches spaces, everything that isn't a-z0-9, one time 这会匹配空格,不是a-z0-9的所有内容,一次

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM