Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个字符集 {x, y, z} 并且我想检查某个字符串是否包含该字符集中的至少一个字符。 例如:
abxyz - valid zabc1 - valid abc4e - not valid
/.*[xyz].*/应该做的伎俩
/.*[xyz].*/
试试这个正则表达式:
.*[x-z].*
这只会匹配[x-z]至少包含一次的行。
[x-z]
例子