您可以使用否定字符类来排除某些字符: 例如,[^abcde]将匹配除 a、 b、 c、 d、 e 字符之外的任何字符。
Instead of specifying all the characters literally, you can use shorthands inside character classes: [\w] (lowercase) will match any "word character" (letter, numbers and underscore), [\W] (uppercase) will match anything but word characters; similarly, [\d] will match the 0-9 digits while [\D] matches anything but the 0-9 digits, and so on.