正则表达式表示一个单词全是辅音字母 和一个单词前几位是辅音字母后几位是元音字母

正则表达式表示一个单词全是辅音字母 和一个单词前几位是辅音字母后几位是元音字母
python

string = "superman"
pattern = re.compile(r'^(?:(?![aeiou])[a-z])+$', re.I)
match = pattern.match(string)
if match:
    print "yes"
else:
    print "no"
    
    
#------------------------

string = "dxloveuo"
pattern = re.compile(r'^(?:(?![aeiou])[a-z])+[a-z]*[aeiou]+$', re.I)
match = pattern.match(string)
if match:
    print "yes"
else:
    print "no"

温馨提示:答案为网友推荐,仅供参考
相似回答