python - Regular expression to match all words ending with and containing three 'e's -
i trying write regular expression matches words vowel e , there 3 e's in word, writing in python. tried writing
(?= e){3}[^aiou]*
but didn't work.
you want 3 e's, such stuff in between consists of non-vowels. want word, i.e. stuff has word boundary on either side.
thus: word boundary, 0 or more non-vowels, e, 0 or more non-vowels, e, 0 or more non-vowels, e, 0 or more non-vowels, , word boundary. can simplify grouping repeated pattern: word boundary, 3 times: (zero or more non-vowels, e), 0 or more non-vowels, , word boundary.
in regex-speak: \b(?:[^aeiou]*e){3}[^aeiou]*\b
.
Comments
Post a Comment