[Question]
  [
Note: the title was misspelled intentionally.
Given a string s, swap the first vowel runs of every 2 words. For this challenge, y is considered a vowel.
For example, given an input of "great day sir":
```
1. Input: "great day sir"
2. Identify pairs of words: "[great day] [sir]" (No word for sir to pair with)
3. Identify the first vowel runs in each word: "[gr[ea]t d[ay]] [s[i]r]"
4. Swap the vowel runs in each pair: "[gr[ay]t d[ea]] [s[i]r]"
5. Return/print: "grayt dea sir"
```
When there are vowel runs of different lengths, you still swap the whole runs. When a word has more than one vowel runs, you still only swap the first one. When the first or second word of a pair of words does not have a vowel, then you do not swap the vowels for those words.
You may assume that the input only consists of one case of alphabetic letters and the literal space or another constant delimiter.
Standard methods of I/O, standard loopholes apply. Leading/trailing whatevers are okay.
**Test cases:**
```
Input -> Output
"great day sir" -> "grayt dea sir"
"ppcg is the best" -> "ppcg is the best" (When there is no vowel to swap, don't swap vowels."
"this is a test case" -> "this is e tast case"
"loooooooooooooong word" -> "long woooooooooooooord"
"great night" -> "grit neaght"
"anything goes" -> "oenything gas"
"qwrtpsdfghjklzxcvbnm aaaaaaaa hi there" -> "qwrtpsdfghjklzxcvbnm aaaaaaaa he thire"
"this is a long test case in case you could not tell" -> "this is o lang tast cese an cise ou cyould net toll"
```
  
[Answer]
# [V](https://github.com/DJMcMayhem/V), ~~42~~, 41 bytes
```
ò2Eá
òÍ¨[aeiouy]«©¨ƒ ƒ©¨[aeiouy]«©/³²±
Íî
```
[Try it online!](https://tio.run/##K/v///AmI9fDC7kObzrce2hFdGJqZn5pZeyh1YdWHlpxqFnhUDOIgSysf2jzoU2HNnId7j287v//xKTi/JzSktScSoXi0qJUAA "V – Try It Online")
Hexdump:
```
00000000: f232 45e1 0af2 cda8 5b61 6569 6f75 795d  .2E.....[aeiouy]
00000010: aba9 a883 2083 a9a8 5b61 6569 6f75 795d  .... ...[aeiouy]
00000020: aba9 2fb3 b2b1 0acd ee                   ../......
```
Explanation:
```
ò       ò                                   " Recursively:
 2E                                         "   Move to the end of two words forward
   á<cr>                                    "   And append a newline
```
This will put all groups of two words on their own line, for example:
```
this is
a long
test case
in case
you could
not tell
```
Now we run some fancy regex-magic:
```
Í                                           " Globally substitute
 ¨[aeiouy]«©                                "   A vowel (capture group 1)
            ¨<131>                          "   Followed by as few characters as possible, then a space
                   <131>©                   "   Followed by as few characters as possible (capture group 2)
                         ¨[aeiouy]«©        "   Followed by a vowel again
                                    /       " With:
                                     ³²±    "   Capture groups '3', '2', '1'
Í                                           " Remove all:
 î                                          "   Newlines
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~39~~ 37 bytes
They said it would be ugly, but I didn't listen... and it was:
```
¸ò ®efQ="%y+" ?Z£XrQZg°T fQP PÃ:ZÃc ¸
```
[Test it online!](http://ethproductions.github.io/japt/?v=1.4.5&code=uPIgrmVmUT0iJXkrIiA/WqNYclFaZ7BUIGZRUCBQwzpaw2MguA==&input=IlN3YXAgdGhlIHZvd2VscyIgLVE=)
### Explanation
```
 ¸  ò ® efQ="%y+" ?Z£    XrQ    Zg° T fQ    P PÃ :ZÃ c ¸
UqS ò mZ{Zef"%y+" ?ZmXYZ{Xr"%y+"Zg++T f"%y+"P P} :Z} c qS
             Implicit: U = input string, such as     "abc def ghi jkl mno"
UqS          Split on spaces, splitting into words.  ["abc","def","ghi","jkl","mno"]
ò            Group into runs of two items.           [["abc","def"],["ghi","jkl"],["mno"]]
mZ{          For each pair Z:
 Zef"%y+"?     If not every item contains a run of vowels (%y = [AEIOUYaeiouy]),
 :Z            return Z.                             [              ["ghi","jkl"]        ]
 ZmXYZ{        Otherwise, for each item X in Z:
  Xr"%y+"        Replace each run of vowels with
  Zg++T           the item at the next index in Z,   [["def","abc"]               ["mno"]]
  f"%y+"P         but only the first run of vowels.  [["e",  "a"  ]               ["o"  ]]
  P              Replace only for the first match.   [["ebc","daf"]               ["mno"]]
 }
}                                                    [["ebc","daf"],["ghi","jkl"],"mno"]]
c            Flatten back into a single array.       ["ebc","def","ghi","jkl","mno"]
qS           Re-join on spaces.                      "ebc daf ghi jkl mno"
             Implicit: output result of last expression
```
[Answer]
# JavaScript (ES6), ~~62~~ ~~106~~ ~~98~~ 101 bytes
```
s=>s.match(/(\w+)( (\w+))?/g).map(m=>m.replace(/([aeiouy]+)(\w* \w*?)([aeiouy]+)/g,'$3$2$1')).join` `
```
```
f=
s=>s.match(/(\w+)( (\w+))?/g).map(m=>m.replace(/([aeiouy]+)(\w* \w*?)([aeiouy]+)/g,'$3$2$1')).join` `
;
[
  "great day sir",
  "ppcg is the best",
  "this is a test case",
  "loooooooooooooong word",
  "great night",
  "anything goes",
  "qwrtpsdfghjklzxcvbnm aaaaaaaa hi there",
].map(f).map(s=>console.log(s))
```
[Answer]
# [Retina](https://github.com/m-ender/retina), 65 bytes
```
((\w*?)([aeiouy]+)(\w* \w*?)([aeiouy]+)|(\w+ ))(\w*)
$2$5$4$3$6$7
```
[Try it online!](https://tio.run/##XU3LDsIgELzzFXvgUPTm8@iHqAcKCChCha21xn9Hao1RJ5NsZiY7ExVaz3Ouql032bBqy5UNbb@fssGAf/NR3CmwV8gIndElXdA5XdF1zjoqjiB5D8lG0jRCg02ARkGtEhI0RRVywCJB8KSICz/wGroQJRmbvNUGCfd9@SyJDiqRSxexSfKgzfHk7jdxrf0Z@Btg7DAX1deWG0o/g2D9ePvQggitk@ADlty5Jw "Retina – Try It Online") Includes test cases. I wanted to use a conditional group reference but I couldn't get it to work in 66 bytes let alone 65 or less.
[Answer]
# [Retina](https://github.com/m-ender/retina), 50 bytes
```
\S+ \S+ 
$&¶
%O$^`(?<=\b[^aeiouy]*)[aeiouy]+
$`
¶
```
[Try it online!](https://tio.run/##VU0xDsIwDNz9Cg8tKvAFECMjA2OhatqGJBCSkrhAeRgP4GMhFRWCky37dPad46QMC2m2LsNuO8ehIZm8npBukqLMVovlrsoLxpXt@v1smo/bHJIS4lUIwnFG2LAevXLQtrVA5ZEkx4p7ApKRxWJIkWLNPAdt/2AE3qxr4ONklJAEzPTxMyrCcg@Xm6PWNwchjyf9uNfXypyRjUCphjjHf7L0YPoNRGU@s7cd1rbTDRpLUdf6DQ "Retina – Try It Online")
−2 bytes thanks to Martin.
* First step is splitting each word pair to its own line (`¶` is newline). This allows us to use `.*` within a pair of words.
* Next, for each line we find the first vowel block in each word, and sort them by position in descending order.
[Answer]
# [Python 2](https://docs.python.org/2/), 148 bytes
```
from re import*
v="([aeiouy]+)"
print sub(r"(\w+)(?: (\w+))?",lambda m:sub(v+"(.* .*?)"+v,lambda g:''.join(g.groups()[::-1]),m.group()),raw_input())
```
[Try it online!](https://tio.run/##NU5LCoMwFNx7ikc2JmqFdhkoHsRKeaKNKc2HZ6Lk9DZt6azmxzA@hcXZy3E8yBmgGbTxjkJVbFfGe5y1i2moBSs8aRtgjSMnxm97LXgn4UtEx5oXmnFCMPJT2GrG2wraqhOs3v6ZkmXZPp22XLWKXPQrF72Up/MgGvNzuBAN4X7X1seQxXEomjHAhAlWTbC4HTB/TC7ClJcUjBmAGaBHhPQG "Python 2 – Try It Online")
Code Golfing is getting addictive!
> 
> Sections off pairs of words, then grabs the 2 groups of vowels and the string in between, reverses the order and uses that as the [substitute](https://docs.python.org/2/library/re.html#re.sub).
> 
> 
> 
[Answer]
## Perl, 58 bytes
**57 bytes code + 1 for `-p`.**
```
$v="([aeiouy]+)";s!\w+ \w+!$&=~s/$v(.* .*?)$v/$3$2$1/r!ge
```
-2 bytes thanks to [@Dada](https://codegolf.stackexchange.com/users/55508/dada)!
[Try it online!](https://tio.run/##VU3LbgIxDLznK7zSCvFQuyoVR8SHtBzCrklSQhxiL9vtgU9vGgSqYOSRNR55JmLyq5y5@hwWUFjVk/WFm@mHRkf9uF3Mpq/zDRTOHm5N/V4v67cmVQZzNgm1QKdHYJdUjK0BxyAWYYcsSmxRZTRIkdBqRuXpCcHAQKlTt6TgjBWlw1g@i2MIWZ2GJJG7vbFfB//z3Z534Qj6DrDuWpfwoctfQ/8LwYXbHqmHlnrfQSApvve/FMVR4PwS/wA "Perl 5 – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 177 173 171 169 bytes
```
unwords.s.words
s(x:y:z)=maybe[x,y]id(do(a,b)<-k x;(c,d)<-k y;j[b c,d a])++s z
s x=x
v=(`elem`"aeiouy")
j=Just
k s=do(a,(x:y,r))<-j$span v<$>break v s;j(x:y,\n->a++n++r)
```
[Try it online!](https://tio.run/##VVBda4NAEHz3VwwmDx5qfkCSC4RSAiUtgdInI80ZD79PuT1TTelvtxf71GVhd2aYWdhcUCXrevoOFzju3w4f@8Mznk4nLMIfR/Pz1KuvVqe0otU8HfKG9bi@M96IMZHREIxxkXpp64kgYduwwrDxrkE6r@OmjBJYBBEz3yfcHcLAB@fGvYusZXNxhSzafnSZU/KXnoxTgfgc9jgTaGZzyiV1QuG2Xe4SLUWFG2hTzvpZhTvh@8r3NZsaUShwNKJ7/YTX9ebd6KPCCpohcjNrNUjFCCq0G7hdd81QEEwukUgyljK5xbYFjCVwFSQtW7f/SmV4PMIKf4mqyHLjxtMv "Haskell – Try It Online")
This is a direct shortening of the following naïve solution, so there should something much better around here:
```
swapvowels :: String -> String
swapvowels = unwords . swapPairs . words
swapPairs :: [String] -> [String]
swapPairs (word1:word2:rest) =
   case (,) <$> extractVowels word1 <*> extractVowels word2 of
     Just ((vowels1, rebuild1), (vowels2, rebuild2))
       -> [rebuild1 vowels2, rebuild2 vowels1] ++ swapPairs rest
     Nothing -> [word1,word2] ++ swapPairs rest
swapPairs rest = rest
extractVowels :: String -> Maybe (String, String -> String)
extractVowels s = do
    let isVowel l = l `elem` "aeiouy"
    (a,b) <- Just $ break isVowel s 
    (w@(_:_),r) <- Just $ span isVowel b 
    return (w, \n -> a ++ n ++ r)
```
[Answer]
# Ruby, 87+1 = 88 bytes
Uses the `-p` flag.
```
gsub(/(\w+) (\w+)/){_,a,b=*$~;a[r=/[aeiouy]+/]&&b[r]?a.sub(r,b[r])+' '+b.sub(r,a[r]):_}
```
[Try it online!](https://tio.run/##KypNqvyvrFgEpBR0C/6nF5cmaehrxJRrayqASX3N6nidRJ0kWy2VOuvE6CJb/ejE1Mz80spYbf1YNbWk6KJY@0Q9kK4iHRBHU1tdQV07CSqSCBKxiq/9/7@wvKikoDglLT0jKzunqiK5LCkvVyERChQyMhVKMlKLUgE "Ruby – Try It Online")
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), ~~363~~ 304+25 bytes
*-34 bytes thanks to @KevinCruijssen*
Golfed:
```
l->{String s[]=l.split(" "),a,b;Pattern p=Pattern.compile("[aeiouy]+");for(int i=0;i<s.length-1;i+=2){Matcher m=p.matcher(s[i]),n=p.matcher(s[i+1]);a=m.find()?m.group():null;b=n.find()?n.group():null;if(a!=null&b!=null){s[i]=s[i].replaceFirst(a,b);s[i+1]=s[i+1].replaceFirst(b,a);}}return l.join(" ",s);}
```
[Try it online!](https://tio.run/##dVPBcqMwDD03X6HlsIM3xN3usZTurbfOdKbHTA4GDJga22uLpGwm354VgWaadFbDIKEnS/KTaMVWrKyTpi3fjqpz1iO05OM9Ks29rOU7/5HC7S28CIJsBdhIyAeUq8L2BheLL4eq3hSorOFPs5EuXJ9rVUChRQjwLJSB/QJIZn9AgaS2VpXQERq/olemXm9A@DqwOXiUj5QPU0QyqUeoIIOjXj3uJweE9SbTPDitMI4gYolI8vRFIEpvwGWzxQvbOaVlHK2FVLYfNsuIpZX1sTIIKvuZqofAtTQ1Nqu7VC2zX2z/LLBopIcuc7yb7Dis1YYl5tKzvNuwVGQdr5QpY/a747W3vYvZvem1TvPMfCDmElFVLL5lo/k9nzTbjxWy8UUzcVoU8kn5gDFdi6VTrWxSl3ieCJYeDl5iTxfXvLXELhGSBHIfb9LFmdnTVGzeEpFG7k6fMSP85jwLZVyPgfA9nE@NEtVeCoRSDBCUj5JL0LmiBhWmtZEBr3FsCKRHABIKhQjyOkTbC6Hx7qwvKermU3mj6oaSX7UmzEAF6ERtZfiC/tl5dKGs6qZ903/fi21uOhCzQKPGpr38f8d67OXcNhE06cH2QD@HLsFYJFzr6Jzh8IlyWjSYV30iF@5nktl0tdchoOy47ZE7ikJt4ooL5/QQn@IYDeiUdHE4/gM "Java (OpenJDK 8) – Try It Online")
Ungolfed:
```
String swapVowels(String line) {
    String[] parts = line.split(" ");
    Pattern pattern = Pattern.compile("([aeiouy]+)");
    for (int i = 0; i < parts.length - 1; i += 2) {
        Matcher matcherL = pattern.matcher(parts[i]), matcherR = pattern.matcher(parts[i + 1]);
        String vowelRunL = matcherL.find() ? matcherL.group() : null, vowelRunR = matcherR.find() ? matcherR.group() : null;
        if (vowelRunL != null & vowelRunR != null) {
            parts[i] = parts[i].replaceFirst(vowelRunL, vowelRunR);
            parts[i + 1] = parts[i + 1].replaceFirst(vowelRunR, vowelRunL);
        }
    }
    return String.join(" ", parts);
}
```
[Answer]
# [Python 3](https://docs.python.org/3/), 198 196 192 bytes
* Saved 6 bytes: thanks to  [Zachary T](https://codegolf.stackexchange.com/users/55550/zachary-t) : `if(m and n)` to if m and n & removed unwanted r for regex string, index i starting from 1 instead of 0
```
from re import*
s=search
a=input().split()
v="[aeiouy]+"
j=1
while j<len(a):
 i=j-1;m=s(v,a[j]);n=s(v,a[i])
 if m and n:a[i]=sub(v,m[0],a[i],1);a[j]=sub(v,n[0],a[j],1)
 j+=2
print(' '.join(a))
```
[Try it online!](https://tio.run/##LY/NbsMgEITvPMUql5jmR3V7i8uTWD5QSsoi2EWAU/nBc3ZwE2mlWX2zq9GkpTqmz3W9Zo6QLWBMnOubKKpYnY0TWiGluXbyXFLApuKmdqO2yPMyHXbCq178OQwW/Few1Gl5EYDKn/ohqtLdjnr0kxzoteMkm32FCJp@gC4bUWX@bmYc36f/i2Mvh@3rxenJ/cYF@IP6ECkj1W4P@7Nn3DLlulaHBdpoCEy/UG2pYHRpleipC89geA4tlmvzQ7gTn4w2zj4A "Python 3 – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `S`, 33 bytes
```
⌈2ẇƛƛ≬k∪$cḊ:‡hAǑ";:vƒiṘ¨vJƛ÷Ȧṅ;;f
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJTIiwiIiwi4oyIMuG6h8abxpviiaxr4oiqJGPhuIo64oChaEHHkVwiOzp2xpJp4bmYwqh2Ssabw7fIpuG5hTs7ZiIsIiIsInRoaXMgaXMgYSBsb25nIHRlc3QgY2FzZSBpbiBjYXNlIHlvdSBjb3VsZCBub3QgdGVsbCJd)
Really really bad, I couldn't find a single good piece of this code
]