擅长:python、mysql、java
<p>见<a href="https://docs.python.org/3.4/library/re.html#regular-expression-syntax" rel="noreferrer">regular expression syntax</a></p>
<p><code>[^a-zA-Z]</code>表示匹配不在a-z或a-z范围内的任何字符</p>
<blockquote>
<p>Characters that are not within a range can be matched by complementing the set. If the first character of the set is '^', all the characters that are not in the set will be matched. For example, [^5] will match any character except '5', and [^^] will match any character except '^'. ^ has no special meaning if it’s not the first character in the set.</p>
</blockquote>
<p>如果您还想排除<code>-</code>,请包括它:<code>[^a-zA-Z-]</code></p>