I use /^[a-zA-Z]+$/
to check if a string is alphabetic and /^((?!some|words|in|blacklist).)*$/
to validate if it does not contain some specific words.
我使用/ ^ [a-zA-Z] + $ /来检查一个字符串是否是字母和/ ^((?!some ||||||||| blacklist)。)* $ /来验证它是否包含某些特定的字符串话。
How can I check for both conditions in a single regex pattern?
如何在单个正则表达式模式中检查这两个条件?
1 个解决方案
#1
6
Use
/^(?!some|words|in|blacklist)[a-zA-Z]+$/
#1
6
Use
/^(?!some|words|in|blacklist)[a-zA-Z]+$/