更新时间:2023-11-26 10:32:40
edit:您可以为此使用以下正则表达式:
Based on your latest edit: You can use following regex for this:
^(?!.*?[^aeiou]{5})(?!.*?[aeiou]{3})[a-z]*$
分拆:
Breaking it down:
[^ aeiou]
= >匹配任何东西,除了元音之外(?!*。[^ aeiou] {5})
=>没有5个连续辅音的情况(?!。*?[aeiou] {3})
=>没有连续3个元音的情况 [az] *
=>确保输入中只有字母[^aeiou]
=> Match anything but vowels(?!.*?[^aeiou]{5})
=> Negative lookahead to make sure there is no case of 5 consecutive consonants(?!.*?[aeiou]{3})
=> To make sure there is no case of 3 consecutive vowels[a-z]*
=> To make sure there are only letters in the input