0

i have to match and print the words which have 3 or more consecutive vowels i wrote the regex like this:- r"[aeiou]{3,}" but this prints only the sequence of vowels from the word not the whole word

for example if i have a sentence "life is beautiful" i want to print the whole word beautiful not just eau

this this the code below:-

import re

def vowel(text):
   pattern = r"[aeiou]{3,}"
   result = re.findall(pattern, text)
   return result

print(multi_vowel_words("Life is beautiful"))
Prune
  • 76,765
  • 14
  • 60
  • 81
  • 1
    You need to find the string of these parts: (1) word boundary (2) 0 or more letters (3) three consecutive vowels (4) 0 or more letters (5) word boundary. Apply the duplicate I tagged and solve. – Prune May 13 '20 at 03:52
  • That's not really a duplicate. The other question is in a different language. – Daniel Giger May 13 '20 at 03:58
  • @Daniel, I think that's debatable considering that the regex needed is so plain-vanilla that it should work in any language. That leaves the printing of matches the only language-specific issue, but I expect the OP knows how to do that. – Cary Swoveland May 13 '20 at 05:01
  • @Prune's suggestion: [here](https://regex101.com/r/SNxQOI/2/). – Cary Swoveland May 13 '20 at 05:04

0 Answers0