I am trying to write a regular expression that matches 3 or more different vowels in a row. I understand to write a regular expression search 3 identical vowels.
/([aeuioy])\\1{2,}/
But, about 3 different... any thoughts..
Please help me to solve this problem! Actually no thoughts in my head.
Look for 3 consecutive vowels. Capture the first in a group. After the first, check if it's not #1 again with a Negative Lookahead. Passing that test, capture the next character. Then use two Negative Lookahead's, one to check if it's not #1 and the other if it's not #2.
The latter step can be OR'ed into a single lookahead.
(?=[aeouiy]{3})(.)(?!\1)(.)(?!\1|\2).
You don't need any test for the last character. The first Lookahead ensures it's one of aeouiy
; the third, negative, lookahead ensures it's not character #1 or character #2.
Not that it's necessarily the most practical option, but this is the only one so far that is an "actual" regular expression:
(iea|oea|uea|yea|eia|oia|uia|yia|eoa|ioa|uoa|yoa|eua|iua|oua|yua|eya|iya|oya|uya|iae|oae|uae|yae|aie|oie|uie|yie|aoe|ioe|uoe|yoe|aue|iue|oue|yue|aye|iye|oye|uye|eai|oai|uai|yai|aei|oei|uei|yei|aoi|eoi|uoi|yoi|aui|eui|oui|yui|ayi|eyi|oyi|uyi|eao|iao|uao|yao|aeo|ieo|ueo|yeo|aio|eio|uio|yio|auo|euo|iuo|yuo|ayo|eyo|iyo|uyo|eau|iau|oau|yau|aeu|ieu|oeu|yeu|aiu|eiu|oiu|yiu|aou|eou|iou|you|ayu|eyu|iyu|oyu|eay|iay|oay|uay|aey|iey|oey|uey|aiy|eiy|oiy|uiy|aoy|eoy|ioy|uoy|auy|euy|iuy|ouy)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With