[Question]
  [
Let's say I have this string:
```
s = "Code Golf! I love Code Golf. It is the best."
```
I want to replace all the [vowels](https://en.wikipedia.org/wiki/Vowel) with repeated "aeiou".
Notes:
* Uppercase vowels should be replaced by an uppercase letter, and lowercase vowels should be replaced by a lowercase letter.
* Consonants (all alphabet characters except for "aeiou") and non alphabetical characters should be kept the same.
Desired output:
```
Cade Gilf! O luva Cedi Golf. Ut as the bist.
```
As you can see, the vowels are replaced in repetitive order of "aeiou".
Another example:
```
s = "This is a test! This is example number two."
```
Output:
```
Thas es i tost! Thus as eximplo numbar twe.
```
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest code in bytes wins.
  
[Answer]
# [C (clang)](http://clang.llvm.org/), 65 bytes
```
i;f(*s){for(i=0;*s++^=2130466>>*s&*s>64?i*5^5%++i^*s&30:0;i%=5);}
```
[Try it online!](https://tio.run/##PczLCoJAGIbhfVfxN2DMIcXysGjQFi0i6A4iwcyxgUnDf6iFeOtNRtDu44H3q/zKlG3jnJaKcmSD6nqqs1ByFKLI1qsojNM0zzkuOOZpvNU8KRJPCF1MFIWbUGovS5gc3b3ULWUwzAB0awFtfzpDBkey66417Duj5nAA0z1r@EsABwsawd5quNRoAyKnXNEpZt/16KcrRYlnkCzhp6N7V8qUDTr/9QE "C (clang) – Try It Online")
## How?
### Detecting vowels
We determine whether the current character at `*s` is a vowel with:
```
2130466 >> *s & *s > 64
```
The value \$2130466\$ is a bitmask describing the positions of vowels:
```
000001000001000001000100010
     ^     ^     ^   ^   ^
zyxwvutsrqponmlkjihgfedcba
```
The shift amount is interpreted modulo 32 (to my knowledge, this is true for at least Intel and ARM processors). This means that we just have to make sure that the character is a letter (with `*s > 64`) and can use the same expression for lower and upper case.
### Turning them into different vowels
An interesting thing about vowels is that all their ASCII codes are odd:
```
A |  65 | 1000001        a |  97 | 1100001
E |  69 | 1000101        e | 101 | 1100101
I |  73 | 1001001        i | 105 | 1101001
O |  79 | 1001111        o | 111 | 1101111
U |  85 | 1010101        u | 117 | 1110101
          ||    |
          ||    '--> always 1
          |'-------> 'case' bit
          '--------> always 1
```
To turn a vowel of a given case into another vowel with the same case, only bits #1 to #4 (0-indexed) need to be modified. This can be represented with the bitmask \$00011110\_2=30\_{10}\$.
Hence a possible formula:
```
new_vowel = old_vowel XOR (x XOR (old_vowel AND 30))
```
where \$x\in\{0,4,8,14,20\}\$ (for A,E,I,O,U respectively).
Given \$i\in[0\dots4]\$, we get \$x\_i\$ with:
$$x\_i=(i\times 5)\operatorname{xor}(5 \bmod (i+1))$$
| i | i \* 5 | 5 mod (i+1) | xor |
| --- | --- | --- | --- |
| 0 | 0 | 0 | 0 |
| 1 | 5 | 1 | 4 |
| 2 | 10 | 2 | 8 |
| 3 | 15 | 1 | 14 |
| 4 | 20 | 0 | 20 |
As C code, this gives:
```
*s ^= i * 5 ^ 5 % ++i ^ *s & 30
```
which, conveniently, is incrementing \$i\$ at the same time.
### Putting everything together
```
i;                  // i is a counter for vowel replacement
f(*s) {             // s is the input string
  for(              // main loop:
    i = 0;          //   start with i = 0
    *s++ ^=         //   update the character *s:
      2130466 >> *s //     if this looks like a vowel
      & *s > 64 ?   //     and really is a letter:
        i * 5 ^     //       turn it into a different vowel
        5 % ++i ^   //       and increment i afterwards
        *s & 30     //
      :             //     else:
        0;          //       leave it unchanged
                    //   (NB: we stop when the result is NUL)
    i %= 5          //   make sure to keep i in [0..4]
  );                // end of loop
}                   //
```
[Answer]
# [R](https://www.r-project.org), ~~94~~ ~~81~~ 79 bytes
*Edit: -2 bytes thanks to pajonk*
```
\(i){u=match(i,v<-el(strsplit("aAeEiIoOuU","")),0)
i[!!u]=v[1:5*2-u[!!u]%%2]
i}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72waMGa5MrknNSy_PLUnGLbpaUlaboWN_1jNDI1q0ttcxNLkjM0MnXKbHRTczSKS4qKC3IySzSUEh1TXTM98_1LQ5V0lJQ0NXUMNLkyoxUVS2Nty6INrUy1jHRLwVxVVaNYrsxaqLERyYklGkjWaaAY6pyfkqrgnp-TpqjgqZCTX5aqABfRU_AsUcgsVijJSFVISi0u0YNYq6lTnFpgC2RBzF-wAEIDAA)
Input & output as character vectors.  
(Splitting-up an input string and reassembling one for the output costs about +36 bytes, for comparison with any alternative approaches that directly use strings).
[Previous 94-byte version](https://ato.pxeger.com/run?1=TY2xCsIwFEX3fMUzU0Krs0sGEZVOLgqCVlrjqwaCCU1SEfFLXOrg5g_5N7ZUxOmee4d77o-yfsmL1FiZM2onnsEX_eF7u2GKX7MoEw3Ekh9KtIyuR5Nkvkxp3E4kCBVNiVqraJGKqoGQCm-CtViytnCibqQSTuYnFlPKSQ4ICgwE8rWsZO7Zn52hZs6XzmrlGR2bPcLM6KIHCWhTIfyWASQelAN_RNih8wPaCjiPHVrRUPdf111-AA) (using `grep` and `toupper`)
[Answer]
# Excel (ms365), ~~183~~, 164 bytes
-19 bytes thanks to @[jdt](https://codegolf.stackexchange.com/users/41374/jdt)
[![enter image description here](https://i.stack.imgur.com/eoqgJ.png)](https://i.stack.imgur.com/eoqgJ.png)
Formula in `B1`:
```
=LET(x,MID(A1,ROW(A:A),1),y,"uaeio",r,SEARCH(x,y),z,SCAN(0,r,LAMBDA(a,b,IF(ISERR(b),a,a+1))),w,MID(y,MOD(z,5)+1,1),CONCAT(IFERROR(IF(r*(CODE(x)<97),UPPER(w),w),x)))
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 11 bytes
```
⟑A[kv¥i$•&›
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLin5FBW2t2wqVpJOKAoibigLoiLCIiLCJUaGlzIGlzIGEgdGVzdCEgVGhpcyBpcyBleGFtcGxlIG51bWJlciB0d28uIl0=)
If I had a nickel for every time I'd answered a vowel-related challenge with an 11 byte Vyxal answer in the last 2 weeks, I'd have 2 nickels, which isn't a lot but it's weird that it's happened twice. Outputs as a list of characters (add the `s` flag if you want a string object).
## Explained
```
⟑A[kv¥i$•&›
⟑           # To each character:
 A[         #  if it is a vowel:
   kv¥i     #    get the (register)th item of the string "aeiou" - wraps around if the register > 5
       $•   #    and give it the same case of the current character
         &› #    increment the register to get the next vowel
```
[Answer]
# [Python](https://www.python.org), ~~109 106 104~~ 98 bytes
```
f=lambda s,i=0:s and((c:=s[0])in(v:='uaeioUAEIO')and[v[:5],v[5:]][c<'a'][i:=-~i%5]or c)+f(s[1:],i)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=PY4xCsIwGEav8luQJNiWOhRKMIOISCcnp5AhbRMaqElp0oKLF3HponfyNjpU1-_xeN_j1d9C6-w8P8egk-JdadbJa9VI8LFhGfUgbYNxTZnnmSDG4okyNEpl3GV_LM-IfDmfOM1FPPGcCsHrHZJIcENZcjfrXLgBarLR2PMtFbEhS6noB2MD1jg6uEbByXV6BSV0blLwX1IoAxgPoVVQKR_SiCz-7_EH)
* -6 thanks to Steffan
# [Python](https://www.python.org), ~~117 116 112~~ 111 bytes
### (not valid - this is just for fun)
```
lambda s:re.sub('[aeiou]',g,s,0,2)
i=0
def g(c):global i;i=-~i%5;return['uaeio','UAEIO'][c[0]<'a'][i]
import re
```
[Attempt This Online!](https://ato.pxeger.com/run?1=PY07CsJAFEX7rOIpyCQwhiAIoqYQEUllZRVTTMyb-GDMhPkINm7EJiC6J3ejoljdw4HDvT7aszvoprvJdHf3Tg4nT63EsawE2KnB2PoyZLlA0r5gvOaWJ3wUBZQmQYUS6nAfTWulS6GAZpQOLzQYzww6b5qc-U_HONsuVtmGFfk-T4o5E2-iIqBjq40Dg7_bSWuocaEM-0tdIay1kj3IQOkTwt_EkDkgC-6AUKJ1cT-Kvn3XffcF)
* -4 thanks to Steffan
* -1 thanks to pxeger
Just wanted to try with a Regex-based approach. The function isn't reusable so it's not a valid solution.
[Answer]
# JavaScript (ES6), 59 bytes
```
s=>s.replace(/[aeiou]/gi,c=>"aAeEiIoOuU"[i++%5*2|c<{}],i=0)
```
[Try it online!](https://tio.run/##XYzBCoJAFEX3fcVzINA0jaBdChERrtrUSlxM01MnRp84owXVt0@2qEVwN/dyzr3ygWvRydbMG7qgLWKr40SHHbaKC3SjjKOkPo9KGYg4YXyDO5nSoT@xTPr@dDVbPsX68coDGS88K6jRpDBUVLqFy7bjJexJFQ6koGhA@C0hpAakBlMhnFGbkHne5E8/ViMwhoMZCQe@He@8bhVC09dn7MDc6GPbNw "JavaScript (Node.js) – Try It Online")
[Answer]
# [Python](https://www.python.org), ~~80~~ 74 bytes
* -6 thanks to [xnor](https://codegolf.stackexchange.com/users/20260/xnor)!
```
V=v='UuAaEeIiOo'
for c in input():print(end=c[c in V:]or(v:=v[2:]+V)[c>V])
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72soLIkIz9vwYKlpSVpuhY3vcJsy2zVQ0sdE11TPTP989W50vKLFJIVMvOAqKC0REPTqqAoM69EIzUvxTY5GiwRZhWbX6RRZmVbFm1kFasdphmdbBcWqwkxEWrwgps6zvkpqQru-TlpigqeCjn5ZakKcBE9Bc8ShcxihZKMVIWk1OISPYgmAA) Full program.
---
# [Python](https://www.python.org), ~~85~~ ~~81~~ 78 bytes
* -4 thanks to [Steffan](https://codegolf.stackexchange.com/users/92689/steffan)!
* -3 thanks to xnor!
```
lambda s,v='uUaAeEiIoO':''.join(c[c in v:]or(v:=v[2:]+v[:2])[c<'a']for c in s)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=PY0xDoJAEEV7TzHSLESloDIbKYwxhkYbrZBigd2wBnYILKuexYbE6J28jShK8pPJ_Dd__u1ZXnWGqr0L__hotJjNX9ucFXHKoJ4anzQHtuRrGeCOUELcE0plJ2ECUoGhEVa2ob4JPRpNTEi9yAmTBWEkEljB96h2fl_LspJK28K2Vphy2GAuxhBAjobD4LgQaJA16IxDzGvtWo4zGoL7rEOdGOiOjeG_8wsrypyDaoqYV6DP-Mn1vW3bzzc)
[Answer]
# [Raku](https://raku.org/), 44 bytes
```
{$!=0;S:g:ii[<[aeiou]>]=<a e i o u>[$!++%*]}
```
[Try it online!](https://tio.run/##PchBC4IwHIbxr/JOrEGGdOpgzkuH8Fw3EZn0Xw5mE52ViJ99eSl4Ls@vo94cfTthqyD8HDJxOF2TR6J1kRaStB3LrBSpBEHDYsyKkEXRZlcufpATgrCCyDArhNUSQNke/GzvhIs1iiGHsS/CX2LkDnqAawg1DS7me/Bbs8qahFuJ4ff0kW1nCM@xramHe9uY@y8 "Perl 6 – Try It Online")
Most of the magic here is in the `samecase` flag on the substitution, whose short form is `ii`. It makes the match case-insensitive, and furthermore carries the case information forward into the substituted text.
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 37 21 bytes
*- 14 bytes of mostly DLosc, and jezza\_99 getting ninja'd*  
*- 2 bytes thanks to jezza\_99*
```
aR-XV{YVW@UvaNz?yUCy}
```
[Try It Online!](https://dso.surge.sh/#@WyJwaXAiLCIiLCJhUi1YVntZVldAVXZhTno/eVVDeX0iLCIiLCJcIkNvZGUgR29sZiEgSSBsb3ZlIENvZGUgR29sZi4gSXQgaXMgdGhlIGJlc3QuXCIiLCIiXQ==)
I'm bad at golfing in pip lol.
```
aR-XV{YVW@UvaNz?yUCy}
aR-XV{                }      Replace (case-insensitive) vowels with ...
      YVW@Uv                 Set y to the (vth*1) vowel
            aNz?yUCy         Copy case to y                     
    
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt) v2.0a0, 21 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
r\v@T°g`aeiŒ`c^H*XèXu
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=2.0a0&code=clx2QFSwZ2BhZWmMYGNeSCpY6Fh1&input=IkNvZGUgR29sZiEgSSBsb3ZlIENvZGUgR29sZi4gSXQgaXMgdGhlIGJlc3QuIg)
```
r\v@T°g`aei`c^H*XèXu     :Implicit input of string
r                         :Replace
 \v                       :RegEx /[aeiou]/gi
   @                      :Pass each match X through the following function
    T°                    :  Postfix increment T (initially 0)
      g                   :  Index into
       `aei`             :    Compressed string "aeiou"
             c            :    Map charcodes
              ^           :      Bitwise XOR with
               H*         :      32 multiplied by
                 Xè       :      Count the occurrences in X of
                   Xu     :        X uppercased
```
[Answer]
# [Haskell](https://www.haskell.org), 93 bytes
```
(%"aAeEiIoOuU")
(x:r)%u@(v:t:w)|elem x u=c:r%(w++[v,t])|1>0=x:r%u where c|x>'Z'=v|1>0=t
o%_=o
```
[Attempt This Online!](https://ato.pxeger.com/run?1=PY07CsJAGIR7TzEuLib4QDsJrA9EJJWVjRokxj8kuLoh2U1S5CY2goheydsoKlYD8w3fnO-Rnx1IyseadYIkYd41FJub0WFn8PQszvwJzWJXLcyS2TWrdFKbm7GVO9op7IokHVHCiMBJuVW0Wuu8rT276g974j3lBkVEKSGoymFz1RT5h-ia4luhfiejox-fIJCk8UmjgRBsqvaEuZJhHS6kygn_pgtXI86gI8KOMt1lX83l8s0X)
Prettified:
```
import Data.Char
g vowels@(vowel:vOWEL:rest) (char:chars)
  | char `elem` vowels
    = mappedChar : g rotatedVowels chars
  | otherwise
    = char : g vowels chars 
  where
    rotatedVowels = rest ++ [vowel, vOWEL]
    mappedChar
      | isUpper char = vOWEL
      | otherwise = vowel
g _ "" = ""
```
```
g "aAeEiIoOuU"
```
[Answer]
# Python 3.8+, ~~183 156 127 117~~ 111 bytes
-29 bytes thanks to ElPedro  
-10 bytes thanks to Neil  
-6 bytes thanks to help from the Discord (mainly by dzaima and me)
```
def x(n):m,j='aeiou',0;return''.join([((m,m.upper())[i<'a'][j%5],j:=j+1)[0]if i.lower()in m else i for i in n])
```
[Answer]
# [Python 3](https://docs.python.org/3/), ~~130~~ ~~122~~ 120 bytes
```
p=print
v='aeiou'
n=0
for i in input():
 if i.lower()in v:p(end=[v[n],v[n].upper()][i.isupper()]);n=-~n%5
 else:p(end=i)
```
[Try it online!](https://tio.run/##PYvBCsIwEETv@Yr1IG1AgyBelJw8SL@h9KB0SxfC7tKkES/@emxBhWFg3mP0lUbhYynqdSJOJvvqjiRzZdgfzCATEBAv0TnV9myABiAX5IlTbReRz1oj977NLXe7tdysusquJUfxN@yF/f7N25MBDBG/L7KlXKVHuEkYNtBAkIzwJw6aBBQhjQgPjMl9AA "Python 3 – Try It Online")
*-8 bytes thanks to myself*
*-2 bytes thanks to The Thonnu*
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 25 bytes
```
sm?}r0dK"uaeio"r@K=hZrId1
```
[Try it online!](https://tio.run/##K6gsyfj/vzjXvrbIIMVbqTQxNTNfqcjB2zYjqsgzxfD/fyXn/JRUBff8nDRFBU@FnPyyVAW4iJ6CZ4lCZrFCSUaqQlJqcYmeEgA "Pyth – Try It Online")
### Explanation
```
sm?}r0dK"uaeio"r@K=hZrId1dQ    # implicitly add dQ to the end
                               # implicitly assign Q = eval(input())
       K"uaeio"                # assign K to "uaeio"
s                              # sum of
 m                        Q    # map lambda d over Q
  ?}r0dK                       # ternary, if lowercase(d) in K:
               r     rId1      #   map case to d of
                @K             #   (looping) index K at
                  =hZ          #   increment Z, and assign it to the increment
                         d     # else: d
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 23 bytes
```
ØciⱮðḟ0ØėṁŒs>5$}¡"Ɗż@œp
```
[Try it online!](https://tio.run/##y0rNyan8///wjOTMRxvXHd7wcMd8g8Mzjkx/uLPx6KRiO1OV2kMLlY51Hd3jcHRywf/D7Y@a1kT@/6/knJ@SquCen5OmqOCpkJNflqoAF9FT8CxRyCxWKMlIVUhKLS7RU9JRUArJAIoAUaJCCVBIUQHGT61IzC3ISVXIK81NSi1SKCnP11MCAA "Jelly – Try It Online")
Jelly isn't great at [string](/questions/tagged/string "show questions tagged 'string'") challenges. Full program, as we take advantage of Jelly's smash printing.
## How it works
```
ØciⱮðḟ0ØėṁŒs>5$}¡"Ɗż@œp - Take a string S on the left
Øc                      - Yield "AEIOUaeiou"
   Ɱ                    - For each character C in S:
  i                     -   Get the index of C in "AEIOUaeiou", or 0 if not found
    ð                   - Begin new dyadic chain, with vowel indices V on the left and S on the right
     ḟ0                 - Remove zeros from V, call that V'
                  Ɗ     - Group the previous 3 links into a monad f(V'):
       Øė               -   Uppercase vowels; "AEIOU"
         ṁ              -   Repeat to the same length as V'
                 "      -   For each pair (v, i) with v a vowel and i an index in V':
                ¡       -     Repeat:
              $         -       Iteration count:
               }        -         Is i...
            >5          -         ...greater than 5?
          Œs            -       Action: Swapcase
                     œp - Partition S at the the indices in V
                   ż@   - Zip the partition and the vowels, with reversed @rguments
```
[Answer]
# [Factor](https://factorcode.org), ~~87~~ 86 bytes
```
[ EBNF[=[ r=([aeiouAEIOU]=>[[96 > 0 -32 ? 0 inc 0 get 1 - 5 mod "aeiou"nth +]]|.)*]=]]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=PY_LTsMwEEX3-Ypbr3goEQ-BeCjlpVJlUxZQNpYXTjppLGI7xA6w4DvYdJMNfAL_0r_BJQJpNFf3zNyRZvVVysLbtl9_zO-z2fQMRmpyjSzIQUtfwdFzR2Zjn6g1VKOhZUK5KaEszqOI3dgFYWrrcoQMtX0h_JMEmYdy8BUhJ-cTFrGHKoBQEj6QEf48vUnd1ATT6Zxa-Fe72WafnS_jk_Ujx-R6dstTjjbd4pKU7a4m2d1cpGPOT48xxh7iwwNcBFWmCH1JHvuIcQRtF2C_EWbCR7tCvCfbOyIVYrj-zdG0yngIFFY31hF8qy6HYd8P-gM)
* `[ ... ]` Define a quotation, or anonymous function, that takes a string as input from the data stack and leaves a string as output on the data stack.
* `EBNF[=[ ... ]=]` Define an anonymous EBNF parser that automatically runs on an input and produces an output.
* `r=` Name the topmost EBNF rule. There has to be at least one rule, so here it is.
* `(...|.)*` Match any number (`*`) of ... or (`|`) anything (`.`). The `.` matches consonants which will remain the same.
* `[aeiouAEIOU]` Match any vowel.
* `=>[[...]]` An EBNF action. The code inside the double brackets will run on each token before being added to the parse tree.
* `96 > 0 -32 ?` Is the vowel we matched lowercase? Push `0` on the data stack if so; otherwise, push `-32` on the data stack.
* `0 inc` Increment the value stored at `0`. In Factor, any value (such as `0`) can be used as a variable (key) to store a value in an implicit hierarchy of hash tables. If `0` contains `f`, which all uninitialized variables do by default, `inc` will cause the value to become `1`.
* `0 get` Get the value stored at `0`.
* `1 -` Subtract one. We do this because it's shorter than initializing `0` to `0`.
* `5 mod` Modulo five.
* `"aeiou"nth` Get the nth letter in `"aeiou"`.
* `+` Add this letter to the `0` or `-32` from earlier. This is what capitalizes the letter or keeps it lowercase.
[Answer]
# [Java (JDK)](http://jdk.java.net/), 125131 bytes
```
s->{String v="aeiouAEIOU",r="";int j=0,p;for(var c:s.toCharArray()){p=v.indexOf(c);r+=p>=0?v.charAt((p>4?5:0)+j++%5):c;}return r;};
```
[Try it online!](https://tio.run/##PY9RS8MwEMff@ynOgpDQLTSgL6vtCENlD7KH4ZP4kLXpltolIUmLY@yz1xtTA8f9Lvcj/NPJUc675mvSR2d9hA5nNkTds3YwddTWsJdfKJKk7mUI8Ca1gXOSALhh1@saQpQR22h1A0dckm302uw/PkH6faDoAp6/d55u29mtVdBCOYV5db7NMJapVNoO4nm9eU9nvkzTQhtMVuYzV7TWk1F6qBeBRbs6SC@8lydC6dmVI9OmUd@bltS08FnpqjJfjqy@WpEQVz0sHxc5zbosu3@ki7q4eBUHb8AXl2K6ZtyeQlRHZofIHKaJvSEtk871J5KubKPg1fbtHayht6OC/xsG6wg6QDwo2KkQWUppgZ@@JJdpyrMcS2DxSSALZIHMkTkyR84ZOgwdhg6yQBbIHJkjc8Z/AA)
(Edited to add some lambda boilerplate.)
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), ~~82~~ 54 bytes
```
i`[aeiou]
a$&
,Y0`a`v`a.
T`v`V`.[AEIOU]
1,2,i`[aeiou]
```
[Try it online!](https://tio.run/##RYxBCsIwFET3OcUUVFyUYL2BiJSs3KggpZBf/NJA2pT2t3r7mI0KA8N7DDOyuJ6KuN6WNjpbEbsw14pWG5Xfd5bsYkmrS6qb1dXhZM7XWhX5Pv9vYzyGB6MM/pnBwIeF8TMaRuAmSMtoeJL01SZMIUjiDF/mN3WDZ/Rz1/AIeQX9AQ "Retina – Try It Online") Link includes test cases. Explanation:
```
i`[aeiou]
a$&
```
Prefix `a`s to all of the vowels, both lower and upper case.
```
,Y0`a`v`a.
```
Cyclically transliterate only the new `a`s to vowels.
```
T`v`V`.[AEIOU]
```
Uppercase the new vowels that precede old uppercase vowels.
```
1,2,i`[aeiou]
```
Delete alternate vowels i.e. the old vowels.
If the input had all been in (say) lowercase, then it could have been done in 11 bytes:
```
Y`v`a
Y`a`v
```
[Try it online!](https://tio.run/##PcjLDYAgEEXRPVU8GyCxHHcMOgoJHwMj2j2y0eRuzi0sPtHc@2KaIbUYMq33NW@MI4d9gkfIjfEfDS/wFeIYlqtoJW5wRJDhCZ/5oXgGRrqi5QK5s34B "Retina – Try It Online") Link includes test cases. Explanation: Simply cyclically transliterates all the lowercase vowels to `a`s and back to vowels.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 28 bytes
```
≔uaeioθ⭆Ｓ⎇№θ↧ι§⎇№αι↥θθＬ⊞Ｏυιι
```
[Try it online!](https://tio.run/##VY3BCsIwDIbvPkXcKYW5F9hp7CAFxYH6AHWLW2G0W5tOffraoQheEvJ/X5J2UK61aoyx8l73BrOgSNssh1mUm8Zpw3jm1PqjmlCaKfBnRJHDhZxR7oW1DUmbczjYB7lWeUItEq9Ymo6e@O@pHHSC12n6urNYv6VtMj0P2AQ/nBJTbB2GVV5vrbWMsbYdwd6O9y1IGO1C8EsKkAzaAw8EN/JcbOJuGd8 "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
≔uaeioθ
```
Get the vowels into a string to reduce repetition, but start with `u` because they need to be 1-indexed.
```
⭆Ｓ⎇№θ↧ι§⎇№αι↥θθＬ⊞Ｏυιι
```
Loop over the input characters, replacing letters whose lowercase can be found in the string of vowels with letters cyclically chosen from the string or its uppercase according to the number of matches so far.
[Answer]
# [Perl 5](https://www.perl.org/) `-p`, 33 bytes
```
s/[aeiou]/$&&a|(<A E I O>||U)/ige
```
[Try it online!](https://tio.run/##K0gtyjH9r6xYAKQVdAv@F@tHJ6Zm5pfG6quoqSXWaNg4KrgqeCr429XUhGrqZ6an/v@flg8Caf4gAAA "Perl 5 – Try It Online")
[Answer]
# [Dart (2.18.4)](https://dart.dev/), 139 bytes
```
r(s,[j=0,v='aeiouAEIOU',t,i=0])=>[for(var c=(l)=>v[(l?0:5)+j++%5];i<s.length;i++)if(v.contains(t=s[i]))c(t.codeUnitAt(0)>96)else t].join();
```
* [Try it online](https://tio.run/##TY1Ba8JAEIXv/RXjoWSXhJCLhTZdi0gpnrzoKeSwmrEZWXdld5IKpb893Vgtwlze8L73NdrzMHgRsuqgiqxXiUZy3fx9udokGWekilqqWbV3XvTaw04JE3NfCfNWvExlekjTx2ld0mvIDdpPbktKU0l70ec7Z1mTDYJVqKiWcic4PhvcWOI5i0LOnp8kmoDAdX5wZIUsh95RA0c9Bvh@ADh5siy8SBaRhA9n9hNYgnE9wv8nhyUDBeAWYYuB80SCUpAs9FigEVmB6XoNC2zoimwY9BWhC1Le29Zt3IungePgBG4Zz/p4Mgi2O27RA3@5m2zdxjmMJWD3R3RhNOCZIuEuhB4JvLh@hl8).
* [Full source](https://github.com/alexrintt/algorithms/tree/master/codegolf/replace-all-vowels-with-repeated-aeiou/dart-2.18).
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 25 bytes
Anonymous tacit prefix function.
```
××(≢⍴v⍨)@(|∊(v←'aeiou')⍨)
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn///D0w9M1HnUuetS7pexR7wpNB42aRx1dGmWP2iaoJ6Zm5peqa4KE/6cBBR719j3qan7Uuwao@NB640dtEx/1TQ0OcgaSIR6ewf/TFNSd81NSFdzzc9IUFTwVcvLLUhXgInoKniUKmcUKJRmpCkmpxSV66gA "APL (Dyalog Extended) – Try It Online")
`×` the case of the letters…
`×` imposed as case onto…
`(`…`)@(`…`)` amend the characters **at** the following locations:
 `|` where the casefolded characters…
 `∊(`…`)⍨` are members of the following constant:
  `v←'aeiou'` the vowels (which are assigned to `v`
… with…
 `≢` the count of such located vowels
 `⍴`…`⍨` cyclically **r**eshaping the following constant:
  `v` the previously created `v`
[Answer]
# [Ruby (2.5.5)](https://www.ruby-lang.org/en/), 113 bytes
```
->(x){p,i='aeiou',0;x.chars.map{|t|(p.include?t.downcase)?(r=p[i%5];o=(t==t.upcase)?(r.upcase):r;i+=1;o):t}.join}
```
[Try it online!](https://tio.run/##PY1Nb4JAEIbv/RUjSSOkumkPvUi2HjgYT73Yk/GwwBDGALOBWaVRfztdqpjMYT7e55nWpb9DoYflV9hHF7sgPTdI7OaL97hXWWnaTtXGXq5yDa2iJqtcjmtROZ@bzHQYrcNW2z29fh5i1qFoLcrZ6TK1qzamN/0Rc7SSmzoyNbfBQrEPg4RzhA1XxQy2UPEJ4blRsBWgDqRESLETFUQH0BqCxIwJGplvqNzJQII5PZgfAfNgaGRe7n92pTf5MiBeNYNpxt7UtkJoXJ1iC3Lm55td6UXoUyB8R1w3urEnj/A/YkYEVTD8AQ "Ruby – Try It Online")
[Answer]
# [Zsh](https://zsh.sourceforge.io/), 87 bytes
[Try it Online!](https://tio.run/##PYxNC4JAGITv/orJDBTB8FCQJRER4alLnaSD1rv42YquGcn@dtuIhLnMwzzzbpKBmVavZf7Q@ZfdITi1EaV8zXiNHKbRm43nWa60@oIEMts3@nweGt117kqtqtOHYBiR0YXZbGGb03yzcreut7SuUg50SzikpjHoe34nHHnBJghQ8CdhJA4CgbSBSAgxNcLRv8I5UUglglBsgn@nV1RWBeHRljHVEB3/7S/g2IHU@0E5J7RI9eED)
  ~~[123 bytes](https://tio.run/##PYxNa8JAGITv@RVjTGGXFHVLrDU0FClScvJST@Ih1nfJl64km6Qk7G9Pt5QKc5mHZ6av01EyPoxtxBYI8AIR4GnBkUcBuiihTDWbbbzbO1JVKMC8gdVhyIXhQ0kauR95QzE/eN1xLoxzq7Krlrgja0@5x1gfTYvXtXh7Xobr1WPvt4f8YemLI@fGmJG@UgXjOBLuuzoTPlQpJ4hRqpZwJzPEGlkNnRJOVOuZ@zv4TC2ySaAtm@C/03dyuZWEa3M5UQXdqT9/D4UNyL5v7WaHBpk7/gA)~~
  ~~[133 bytes](https://tio.run/##PYzBToNAAETvfMWUYrMbtJU2tIIS0xhjOHmwHgzhAHXJAluWwIIGgr@ONI0mc5mXN9PVfEwI7cfWI1sbWwe7DXYO7mx6n3k3lpbICjmI0ZPadak10D4IYOSugPeDIGKpbEKE4WJBiGlmlGpllRYqgdHnq2D/7L@@X5zV9DCnBiGdN88fHOvx1t2srzuzDbIr27RCSodhGNmRSwyalkB/kp8ML1IkM/gQsmX4J0v4CmkNxRliVqulfh4c@ISmRFATm@Gvs@/oVAqGojnFrIL6khf/QzYVRFMc@dnai5JHMVN4k02pj78)~~
```
w=UAEIOuaeio;for k (${(s::)1}){let j+=${k/[$w]/1}
printf ${k/[$w]/$w[j%5+(#k<91?1:6)]}}
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 17 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
žMIlåÅÏžM¾è¼s.uiu
```
I/O as a list of characters.
[Try it online](https://tio.run/##yy9OTMpM/f//6D5fz5zDSw@3Hu4HMg/tO7zi0J5KvdLM0v//o5WclXSU8oE4BYhTgVgBiN2hYjlAnAbEilBxTyidA5UvQ9JDjDl6SOaUQNmZQFwMZYPEMpD0J0HZxVA5PaVYAA) or [verify all test cases](https://tio.run/##PcoxCsIwGAXgvad47WxzhVIqSAUnpc4p/tJA2ohJrRVXXQXvIHgBN3Fo8CJeJGZReMP7Hk9pXgpyx12fRPicr4iSfj6O3Ps109Le7MlefB1e9j48NWtF6yJWTEdseLhMrQgTJdchcki1I/wXhtxAaJiKUJI2LFhUnj4cxjvEz7Tn9UYSmrYuaQvTKRakzQopFv6HpTAVMr4RhksUqiOpmYvjRsWSH/ov).
**Explanation:**
```
žM           # Push string "aeiou"
  I          # Push the input-list
   l         # Convert each letter to lowercase
    å        # Check for each letter if it's in the vowels-string
     ÅÏ      # Apply on the truthy indices of the (implicit) input-list:
       žM    #  Push string "aeiou" again
         ¾è  #  Get the (modular) 0-based `¾`'th vowel
           ¼ #  Then increase `¾` by 1
       s     #  Swap so the current character is at the top
        .ui  #  Pop, and if it's uppercase:
           u #   Uppercase the indexed vowel as well
             # (after which the list of characters is output implicitly as result)
```
[Answer]
# [Ly](https://github.com/LyricLy/Ly), 58 bytes
```
"uoiea">ir[s<l'ZLsf:l' *+fsp~[p' *sp:l-s>pl<psprlr00]pp>o]
```
[Try it online!](https://tio.run/##y6n8/1@pND8zNVHJLrMoutgmRz3KpzjNKkddQUs7rbigLroAyCousMrRLbYryLEpKC4oyikyMIgtKLDLj/3/3zk/JVXBPT8nTVHBUyEnvyxVAS6ip@BZopBZrFCSkaqQlFpcogcA "Ly – Try It Online")
I thought this would be a "minor" variation on another answer I coded earlier this week. I was wrong. :)
The code uses one stack to hold a list of vowels. They are rotated each time one of them is used. And it uses a second stack as a "burndown" list of the input characters (codepoints). It copies one input character at a time to the vowel stack, searches for it, and if found substitutes the "next" vowel for the top of the burndown stack. Then it switches back to the burndown stack and prints the top codepoint as a character.
The upper/lowercase logic adds a bunch of code to the program and chaos of temporary stack entries...
```
"uoiea">ir  - setup...
"uoiea"     - push vowels onto the stack
       >ir  - switch to a new stack, read STDIN into the stack and reverse
[s<l'ZLsf:l' *+fsp~[...if vowel...]pp>o] - process each char
[                                      ] - loop until empty
 s<l                                     - copy char to vowel stack
    'ZL                                  - upper case?
       s                                 - save result
        f:                               - pull char forward, duplicate
          l                              - retrieve upper case 1|0
           ' *+                          - map to lowercase if appropriate
               f                         - pull original char forward
                sp                       - save it and delete
                  ~                      - search for lower case char
                   [...if vowel...]      - if it's a vowel, do this block
                                   pp    - clean up the stack
                                     >o  - switch stack, print top entry
p' *sp:l-s>pl<psprlr00 - code block run if we find a vowel
p                      - delete "if" test var
 ' *                   - calculate "should uppercase" delta
    sp                 - save and delete from stack
      :                - duplicate current vowel
       l               - load "uppercase" delta
        -              - convert case if called for
         s>            - save vowel to print, switch stacks
           pl          - delete original vowel, load replacement
             <         - switch back to rotating vowel stack
              p        - clean-up stack
               sprlr   - move vowel on top of stack to the bottom
                    00 - push entries on stack to match non-vowel state
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 17 bytes
```
f€ØcØėṁȯ"Œl⁺i$}¡"
```
[Try it online!](https://tio.run/##y0rNyan8/z/tUdOawzOSD884Mv3hzsYT65WOTsp51LgrU6X20EKl/4fbgdKR//8rOeenpCq45@ekKSp4KuTkl6UqwEX0FDxLFDKLFUoyUhWSUotL9JR0FJRCMoAiQJSoUAIUUlSA8VMrEnMLclIV8kpzk1KLFErK8/WUAA "Jelly – Try It Online")
Was originally `e€ØcÄịØėa@Ʋo⁸O|O&32ƊỌ`, but that eventually turned into this with some inspiration from caird's answer.
```
 €                   For each character of the input,
f Øc                 filter it to AEIOUaeiou, producing a mix of empty and length-1 strings.
    Øėṁ              Mold AEIOU to the same shape as that.
       ȯ"            Replace empty strings with corresponding characters from the input.
                "    For each pair of such corresponding elements:
         Œl          lowercase the result
               ¡     if
           ⁺  }      the original lowercased (and wrapped in a string)
            i$       contains the original.
```
[Answer]
# [Zsh](https://www.zsh.org/) `--extendedglob`, 63 bytes
```
v=aeiouAEIOU
<<<${1//(#m)[$v]/$v[$[#MATCH>91?1+i++%5:6+i++%5]]}
```
[Try it online!](https://tio.run/##qyrO@F@cWpJfUKKQWlGSmpeSmpKek5/ElaahqfG/zDYxNTO/1NHV0z@Uy8bGRqXaUF9fQzlXM1qlLFZfpSxaJVrZ1zHE2cPO0tDeUDtTW1vV1MoMQsfG1v7X5EpTUHLOT0lVcM/PSVNU8FTIyS9LVYCL6Cl4lihkFiuUZKQqJKUWl@gp/QcA "Zsh – Try It Online")
[Thanks to @roblogic for the answer without `--extendedglob`](https://codegolf.stackexchange.com/a/255786/86147) which kicked this off. I've got basically the same logic, just using `(#m)`+`$MATCH` to keep track of the upper/lower case within a single PE.
[Answer]
# [Arturo](https://arturo-lang.io), 79 bytes
```
$=>[i:0v:"aAeEiIoOuU"map&'c[(v=v--c)?->c[x:(c>`^`)?->0->1v\[x+i%10]'i+2]]|join]
```
[Try it](http://arturo-lang.io/playground?ujcLPQ)
[Answer]
# [Scala](http://www.scala-lang.org/), 147 bytes
Golfed version. [Try it online!](https://tio.run/##XY8xa8MwFIT3/IqLoSDRYNqhS4wKJUMJFDok6VI6KMlzrFa2jPScuIT8dle20w4FDe@k@@6ewk5b3bntJ@0Yb@5EdlWYnHGeAHvKUWpTCe0PYY4n7/X3@4q9qQ4fco5NZRgK56735aKdj09SnY/aQ9QzI5VINBnXJLM7mbVpqWvB6tHkok53ruKYHQSn7F5isZcyghZe1cLcPMisF05FM6cmbOo6Onz0DhPIBoLPzK26z9xlUCzT8mvc4dLF9YE6zmwrkYtk4faEZ2fzKZaw7kj4u0mxZJgALghbCpwmEkohWejeYHrkFbY5aixob67IhqGviBmQ/4XrIkbGo8Exc4pfTa0ua0uomnIb/8En99u3LmIiRRPYjUQT@hJqTSTcQOieoLHuMrl0Pw)
```
def f(x:String)={var (p,i)=("aeiou",0);x.map(t=>if(p.contains(t.toLower)){val r=p(i%5);val o=if(t.isUpper)r.toUpper else r;i+=1;o}else t).mkString}
```
Ungolfed version. [Try it online!](https://tio.run/##XZDBasMwEETv/oqpoWBTMO2hl0ACJYcSKPSQpJfSg5LIsVrZEvI6cQn@dndt2W4ICLSa3TcjttwLLdrW7L7lnvBhzlKvM5USLgFwkClyoYpIuGM5w4tz4vdzTU4Vx694hm2hCPN@EjgJjXQG38V8MVWI6lGOO92Pe8ByOxRSmSqcVAfF6uPwrpNcWFzAQYtBAlSKyCZ7UxB/rowoIfPGP3dxPLmPCY69bKRwj@f4pmW41TlRosqttYzDsVNfQupSwl0RCg9zPF0JZqobP30dTf/NoWqS/MdvIfByf1kWSBdRGoVLc5B4NTq9wwranCQmJcGKoEpQJrGTJSUhb5I3txTdgOqQd@jqJLCUBzUgW4IYENUjt4GbjC35CBB73mF8y1rkVksUVb7jTdDZjHmbjB0lD4GMJ6qyC5G1YsL0hOgI6eOaoAna9g8)
```
object VowelShift {
  def main(args: Array[String]): Unit = {
    val f: String => String = (x: String) => {
      val p = "aeiou"
      var i = 0
      x.map { t =>
        if (p.contains(t.toLower)) {
          val r = p(i % 5)
          val o = if (t.isUpper) r.toUpper else r
          i += 1
          o
        } else {
          t
        }
      }.mkString
    }
    println(f("Code Golf! I love Code Golf. It is the best.") == "Cade Gilf! O luva Cedi Golf. Ut as the bist.")
    println(f("This is a test! This is example number two.") == "Thas es i tost! Thus as eximplo numbar twe.")
  }
}
```
]