[Question]
  [
## Input
A string of printable ASCII characters, for example:
```
This is an example string.
```
## Output
For every consonant (`BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz`) that is not followed by a vowel (`AEIOUaeiou`) add the last vowel before it, in lowercase.  
**Consonants before the first vowel are left as-is**:
```
Thisi isi ana examapale seterinigi.
```
## Test cases
```
AN EXAMPLE WITH A LOT UPPERCASE (plus some lowercase)
=> ANa EXAMaPaLE WITiHi A LOTo UPuPEReCASE (pelusu some lowerecase)
And here comes a **TEST** case with 10% symbols/numbers(#)!
=> Anada here comese a **TESeTe** case witihi 10% siyimiboloso/numuberese(#)!
This is an example string.
=> Thisi isi ana examapale seterinigi.
abcdefghijklmnopqrstuvwxyz
=> abacadefegehijikiliminopoqorosotuvuwuxuyuzu
A pnm bnn
=> A panama banana
Tell me if you need more test cases!
=> Telele me ifi you neede more tesete casese!
```
## Scoring
As this is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), the answer with the lowest byte-count **in each language** wins (no answer will be accepted).
  
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 48 bytes
```
i`(?<=([aeiou]).*?[^\W\d_aeiou])(?![aeiou])
$l$1
```
[Try it online!](https://tio.run/##NY5dS8NAFETf8yumWCHJQ7XvSggSUKga7EoLrR@b5LZZ3ezGvRvT@OdrFIV5msMwx5FXRs6PR/UaJheX4UaSst1TNIuTzfN2ta1e/oowmfyzYKqn4yK9Q7ZOb/NFhtWNuEaKxb3AY55nD1fpMkPY6o7BtiFo25MrJVMUpKZCTY5QjoAhEcciW4o4xg9Hr3yN@fkpeGgKq/nMdE1BjsOTaBKIWjHGSAM6yKbVBPZOmf0skEVZ0W5fq7d33Rjbfjj23Wd/GL4CQVpjlFA7DLaDIarQ2NHAE/vfV558Aw "Retina – Try It Online") Explanation: The lookahead searches for a point not followed by a vowel, while the lookbehind searches for an immediately preceding consonant and a previous vowel, which is then inserted in lower case.
[Answer]
# JavaScript (ES6), ~~108~~ 105 bytes
*(Saved 3 bytes thanks to @Shaggy.)*
```
f=s=>(t=(s+=' ').replace(/[aeiou]|[a-z][^aeiou]/ig,r=>r[1]?r[0]+v.toLowerCase()+r[1]:v=r,v=''))!=s?f(t):s
```
Searches for vowels *or* for consonants with no following vowel:
```
/[aeiou]|[a-z][^aeiou]/ig
```
(We don't need to search for consonants explicitly, because vowels are excluded based on the `/[aeiou]|...`.)
Vowels are stored in `v`, and consonants with no following vowel have `v` inserted:
```
r[1]?r[0]+v.toLowerCase()+r[1]:v=r
```
(If `r[1]` exists, we've matched on a consonant plus non-vowel.)
If nothing has been changed, we return the input. Otherwise, we recurse on the replaced string.
```
f=s=>(t=(s+=' ').replace(/[aeiou]|[a-z][^aeiou]/ig,r=>r[1]?r[0]+v.toLowerCase()+r[1]:v=r,v=''))!=s?f(t):s
console.log(f('A pnm bnn'));
console.log(f('abc'));
console.log(f('AN EXAMPLE WITH A LOT UPPERCASE (plus some lowercase)')); 
console.log(f('And here comes a **TEST** case with 10% symbols/numbers(#)!'));
console.log(f('This is an example string.'));
console.log(f('abcdefghijklmnopqrstuvwxyz'));
console.log(f('Tell me if you need more test cases!'));
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~134~~ 119 bytes
```
def f(s,v=''):u=s[:1];return s and u+v*(u.isalpha()-g(u)-g((s+u)[1]))+f(s[1:],[v,u.lower()][g(u)])
g='aeiouAEIOU'.count
```
[Try it online!](https://tio.run/##HZBNT4NAEIbP9ldMY8zuUkTxiMGEGBKbVG0sjSaEA6ULrC67uB@0@Odx6WUu78c8M/1oWikepulIa6ix9ocYIRLZWOdRWDwqaqwSoKEUR7CrwcM2YLrkfVticttgOw@sV5bkYUHIyjXkYVT4@eDbgMsTVZgU@ewryKKJUUmZtEm6ft@joJJWmKmWytUzATlK3iD9Sl63mxQ@19kLJLB5z2C/3aYfz8kuBdxzq0HLjsKluio1JcgHlDi4lioKldMcK3helu4yz4PZAidmWgjvb0CP3UFyfSdsd6BK42uynONZyxzBfCPQc9n1nII2iokmmNXyULnfNC37/uGdkP2v0sYOp/P4d8lSzsEBsRpGaUFQeoROOhRDtbms10tURIur3hUa0D6Kn5Dv3kQW0z8 "Python 2 – Try It Online")
EDIT: 15 bytes thx to [Lynn](https://codegolf.stackexchange.com/users/3852/lynn)
[Answer]
# [sed 4.2.2](https://www.gnu.org/software/sed/), 64 bytes
```
:
s/(([aeiou])[^a-z]*[b-df-hj-np-tv-z])([^aeiou]|$)/\1\l\2\3/I
t
```
[Try it online!](https://tio.run/##HY7dSsNAGETv9ymmqJAEYqzeeRckYKFqsRGFpsKm@dps3Z@Yb9M/fHZjLMzVnIE5TFXf3wtOgmAhSbluGS4@ZXxaRosyrtZxvY1tE/vd0ITBQM6Tn8swKcaFLm6Lu2QifN@nz8g@0qfZNMP7JH9EiulLjrfZLHt9SOcZgkZ3DHaGoN2e2pVkCkVqK9TUElYDYEhEUZ7N8yjCP8de@Rrjmyvw0ZROc2I7U1LLwUU4EnmtGEOkBR2kaTSBfavs5lrIclXRelOr7Zc21jXfLftutz8cTyJFYw1Ka0VOWmPQUWscXQdLVMG4wcUT@/M/j35d45Wz3MftHw "sed 4.2.2 – Try It Online")
[Answer]
# [Standard ML](http://www.mlton.org/), ~~225~~ 223 bytes
```
str o Char.toLower;fun?c=String.isSubstring(it c)"aeiou"fun g(x,l)$d=(fn l=>if Char.isAlpha$andalso not(?d)then if? $then(it$,l)else(x,l^x)else(x,l))(l^str$)fun f$(c::d::r)=f(g$c d)(d::r)|f$[c]= #2(g$c c);f("","")o explode;
```
[Try it online!](https://tio.run/##bdFtb9owEAfw93yKa5pJNurYw0tQilCF1EmsQ4Vpk7YhXZIL8erYaWwXqPbd2SXZEC9QguKg8/98v7hKv620t@Z4dL4BC3clNiNvF3ZHzaQIZpolK98osx0ptwqp69ZCechkhKRsiLgItmJ/o2WcJ6IwoJNbVfRBys10XWKMJkftLBjrxTSXviQDqphC3K44LebdpB21MZv9aSml0BtuGcu2SRGLbDzOx@NGJoXYxhnkUnSvf4r4R/YrgeuP3d@ZnBQiim6iSFqgfa1tTpPjC2ooIAHlJ4Oap/CigGj2APPvs8/LxRy@fVrfwwwWX9bwdbmcP97NVnMQtQ4OnK0IdEuSoSMZwQainyaS50Emh5IagoxrHSAMh@v5aj0cQrsFdsqX8OH9G3CHKrXavTOhSqlx4lpeXYpbl8oB32h4AKxqTdDTjy5VY5rlVGxL9ftJV8bWz43z4WW3P7xePCrUpoLUmIuNSWvgafkLHmwAQ5RDZXkuT853s7jzAw/EcJDcwuwBO0dcYi@p7lVvaRkzsCb94yT2DGeg1Il2GQZzPDOk/4i0pjNGVaoeUh1UpdjSOttqBubkTS1om9YCKmh/aLAzxBpbRfLEs6qtGrVlmGKGbEdbYj31pDSHsqB9tg0Hs2LYhX04hNfQnRFqjqsQUn4Y7BqR5qsnUyczOqFxv56NrgZDefwL "Standard ML (MLton) – Try It Online")
**Less golfed:**
```
val lower = str o Char.toLower
fun isVowel c = String.isSubstring (lower c) "aeiou"
(* c is the current char, d is the next char, x is the last vowel and l the accumulator 
   for the resulting string *)
fun g (x,l) c d = 
    if Char.isAlpha c andalso not (isVowel d)
    then if isVowel c 
         then (lower c, l^str c)
         else (x, l^str c^x)
    else (x, l^str c)
fun f t (c::d::r) = f (g t c d) (d::r)
  | f t [c] = #2(g t c #"d")
val h = f ("","") o explode;
```
[Try it online!](https://tio.run/##bZFta9swEMff@1NcFQaWybKHlykZhBLooOvC4j3AtoBsX2KtsuRaVpOUfffsJDUPjNgY23f/@9/dT7ZRrxvVG73fPwkFymywgwnYvgMDN7XoRr2588EkWTkN0n6jHwUlaRZ9J/V6JO3CFTZ8QxrrSw5MoDSOxSpKbIeKU1UFkwTokqtoLu1UtbWgjNCVUNaANj2khzYVD@q@Ru1LTt1DGI65Q98hqKUfveQnASqLvv8htdzG5P9xHmddAfUvx@NqPO44bbmCdE0hGp1DGoJU/TfIfpa/STB4/yIYsIqRicdYx0LGhoxxAonbVpkKr/ctYerTGtj0HmY/pp/mdzP4/jG/hSncfc7h63w@@3IzXcwgbZWzYE2D8UxKYZEzWAL7pRm/Tk5GuoIaO4SStBYEZFk@W@RZBr4ENrKv4d3bV2B3TWGUfaNdU2Bn0wG/umSX19ISZzoOGlo0rUKIZzu6pBZFWeFqXcs/D6rRpn3sbO@eNtvd88VRodUNFFpfbIxKAW1Lx7wzDjRiBY2hvXq0fdjFng@cpFky@QDTexE4irmIJOWtjCwNwXREE19wIvF0Z0AxEA0eWlTijCEeIGKOZxhlLSNIuZONJJbGGk/TEU4q8kC9mwcowT9Ci8BQtMJTxB5pV7mWIy8ThSgFscM1Ej35IBWZEkHzaDoyJopu47Zu555dmBFasmsEFPTSIjRCRXdEJo/M8AiN@kVseJVkfP8P "Standard ML (MLton) – Try It Online")
[Answer]
# Perl 5, ~~68~~ ~~67~~ 59 bytes
```
perl -pe '$v="[aeiou])";1while s/($v[^a-z]*[b-z]\K(?<!$v(?!$v/\L$1/i'
```
Here's a great example of the usefulness of `\K`, and I can't believe I didn't know about this feature before Dom Hastings pointed it out.
I haven't been able to get the right behavior with just using `s///g`, so an actual loop seems necessary. (It's possible that the right use of a look-behind assertion could work without an explicit `while` -- but I haven't found it.)
[Answer]
# JavaScript ES6, 115 bytes
*Saves 8 bytes thanks to @ETHProductions*
```
s=>[x="",...s].map((i,j)=>(r=/[aeiou]/i).test(i)?x=i:/[a-z]/i.test(i)&&!r.test(s[j]||1)?i+x.toLowerCase():i).join``
```
I have managed to inflate this more in the process of golfing it O\_o but it also fixes a bug
```
s=>[x="",...s].map(             // Create a new array with x storing last vowel
                                // This also offsets indexes by one so rel to original str refers to next char
   (i,j)=>                      // Going through each char...
      (r=/[aeiou]/i).test(i)?   // If it's vowel, store it in x
          x=i:
      /[a-z]/i.test(i)          // If a letter (thats not a vowel excluded by above)
         &&!r.test(s[j]||1)?    // Test if next char is *not* vowel
         i+x.toLowerCase():i    // If it isn't, then add the most recent vowel after
    ).join``                    // Combine back to string
```
[Answer]
# JavaScript, ~~88~~ 82 Bytes
Done with a single regular expression:
Original Version (88 Bytes):
```
s=>s.replace(/(?<=([aeiou]).*?(?![aeiou])[a-z])(?=[^aeiou]|$)/gi,(_,c)=>c.toLowerCase())
```
Updated Version (82 Bytes) after looking at [Neil's regular expression](https://codegolf.stackexchange.com/a/166373/15968):
```
s=>s.replace(/(?<=([aeiou]).*?[^\W\d_aeiou])(?![aeiou])/gi,(_,c)=>c.toLowerCase())
```
```
var tests = {
  "AN EXAMPLE WITH A LOT UPPERCASE (plus some lowercase)":
    "ANa EXAMaPaLE WITiHi A LOTo UPuPEReCASE (pelusu some lowerecase)",
  "And here comes a **TEST** case with 10% symbols/numbers(#)!":
    "Anada here comese a **TESeTe** case witihi 10% siyimiboloso/numuberese(#)!",
  "This is an example string.":
     "Thisi isi ana examapale seterinigi.",
  "abcdefghijklmnopqrstuvwxyz":
    "abacadefegehijikiliminopoqorosotuvuwuxuyuzu",
  "A pnm bnn":
     "A panama banana",
  "Tell me if you need more test cases!":
     "Telele me ifi you neede more tesete casese!"
};
for ( test in tests )
{
  var result = (s=>s.replace(/(?<=([aeiou]).*?[^\W\d_aeiou])(?![aeiou])/gi,(_,c)=>c.toLowerCase()))(test);
  console.log( result === tests[test], result );
}
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt) `-P`, 28 bytes
```
ó@\ctX ©\VtYÃËè\v ?P=D:D¬qPv
```
[Try it online!](https://ethproductions.github.io/japt/?v=2.0a0&code=80BcY3RYIKlcVnRZw6NcdnRYID9QPVg6WKxxUHY=&input=LVAKIkFuZCBoZXJlIGNvbWVzIGEgKipURVNUKiogY2FzZSB3aXRoIDEwJSBzeW1ib2xzL251bWJlcnMoIykhIg==)
### Unpacked & How it works
```
UóXY{\ctX &&\VtY} mD{Dè\v ?P=D:Dq qPv
UóXY{           }  Split the string between any two chars that don't satisfy...
     \ctX &&\VtY     The first char is a consonant and the second is a non-vowel
mD{                And map...
   Dè\v              If this item is a vowel...
       ?P=D            Assign it to P and return as-is
           :Dq qPv     Otherwise, split the item into chars and join with P lowercased
                       (P starts with "", so beginning consonants are not affected)
-P                 Join with ""
```
The `ó` function wins over any kind of regexes.
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~146~~ ~~143~~ ~~132~~ ~~127~~ 125 bytes
```
(a,v="")=>[...a].map((b,i)=>(w=/[aeiou]/i).test(b)&&(v=b)?b:w.test(a[i+1]||b)||!b.match(/[a-z]/i)?b:b+v.toLowerCase()).join``
```
[Try it online!](https://tio.run/##bY5RS8MwGEXf/RXfKo6k21L3KlQpo6BQdbiKQiks6bI1I01Kk7Yq/e81xTcZ3KfLuYd7ph01RSNqu1L6wMdjOCK67ELPw@F9RgihOalojRBbCtegPgwyyoVu80BgYrmxiOH5HHUhww/srv@raCYW63wYGB6GGXMCW5TIDVc/08xxbNERqxPd82ZDDUcYk7MWar8fC62MlpxIfUJH5KWlMOBCFfAvWtWSg7GNUCfiYXz1D6asuNBGLxB/Rs/bJIaPp/QRIkheU3jfbuO3TbSLAdWyNWB0xUFOhwp3CF/yqAOUvOFQONQ9At9P413q@zAtoBe2hPXtDZjvimlpAtVWjDcGXeOZs42/ "JavaScript (Node.js) – Try It Online")
[Answer]
# [Perl 6](https://perl6.org), ~~75 73 71~~ 69 bytes
```
{({S:i/.*(<[aeiou]>).*<-[\W\d_aeiou]><()><![aeiou]>/$0.lc()/}...*eq*).tail}
```
[Try it](https://tio.run/##rZLtatswFIb/6ypOWDZsL1XaDfqj@WBmBFroutB6dNCGIduniVZZci2rSRpy7dmRnZRcwPAnet/z6JwXlVip852zCK/nPBswVqzhU2ZyhNFuE2zuLmSfR8HwQaA0bjYOeTQ8eXi8f8z/7FeGQTgedg56v3vKVRaE/S3nPMKXKOS1kGq7I@y3Gm0NI@hGVzdcSY2WV6Y2VfBlND4LeSHKC9gAfzid9eh9NuPWpbaugq8hbBnzLSYEGLBSCQ2fG9qAPZlqDz4ZQ9CVunR1r4urErMa8xA2DEBa8BPt1bAH7/rRLy8pCbbd3WKBRYoV1AvKxCxR2Q4bjaFZRxIQajxIaLHDWLKgHeimtnAlilIhUN9Sz7kv9KoE/wgtGoMohbdgjWSSc8kZi29g8jv@Mb2ewP1VcgkxXP9M4Nd0Orn9Ht9NICiVs2BNgaBo4yoTFkNPj29EUymmoq2Vl7KtNlTuqB73ACSCO0Jgy2CxzmHhx8pIoiEgipLJXRJF4A2wlPUCzk4/gl0XqVG2r52PxwYfwiaXWItcHAHwQMAEjxhyIVuKXMtCEshY41HOJ2qxof2PIEWa5fg0X8i/z6rQpnypbO1el6v1m0eIVGSCdJwjOeSzVNQMucyLqaghcrqlW7m1e3MUDJS6gFTrZkwoaddCQEofLahXVAooS/kEa@NAI@ZQmOZ00GH0Y7fnhnx0tU75bsV3LzXfurHzDw "Perl 6 – Try It Online")
```
{({S:i{.*(<[aeiou]>).*<-[\W\d_aeiou]><()><![aeiou]>}=$0.lc}...*eq*).tail}
```
[Try it](https://tio.run/##rZLvbtowFMW/@ykuGpuSjHqwSf3QAlo0IbVSy1CbqZNaNDnJLXh17DSOCxTx7Ow6oRUPMOWvfM79@d4jl1ip072zCC@nPDtnrNjAp8zkCKP9Ntjensktj4LhvUBp3Hwc8mh4cv9w95D/OawMg3A87Lzpu1G3z1W245xH@ByFvBZS7fYE/V6jrWEE3ehyypXUaHllalMFX0fjQcgLUZ7BFvh9f96j92DOrUttXQXfQtgx5htMCHDOSiU0fG5o5@zRVAfwyRiCrtSlq3tdXJeY1ZiHsGUA0oKf56CGPXjXj355STmw3f4GCyxSrKBeUiJmhcp22GgMzTqSgFDjm4QWO4wlS9qBbmoL16IoFQL1LfWC@0KvSvCP0KIxiFJ4C9ZIJrmQnLF4CpPf8fXsagJ3l8kFxHD1M4Ffs9nk5kd8O4GgVM6CNQWCoo2rTFgMPT2eiqZSzERbKy9kW22o3FE9HgBIBHeEwJbBYp3D0o@VkURDQBQlk9skisAbYCXrJQz6H8FuitQo@0U7H48NPoRNLrEWuTgC4BsBEzxiyKVsKXIjC0kgY41HOZ@oxYb2P4IUaZbj42Ip/z6pQpvyubK1e1mtN68eIVKRCdJxgeSQT1JRM@Qyz6aihsjpVm7tNu7VUTBQ6gJSrZsxoaRdCwEpfbSgXlEpoCzlI2yMA42YQ2Ga00GH0Y/dnhvy0dU65bsV373UfOvGzj8 "Perl 6 – Try It Online")
```
{({S:i{.*(<[aeiou]>).*<:L-[_aeiou]><()><![aeiou]>}=$0.lc}...*eq*).tail}
```
[Try it](https://tio.run/##rZLvatswFMW/6yluWDZsr9WaDfohTcLMCLSQdaHx2KCUIdu3iVZZci2riRvy7NmVnZQ8wPB/n3N/uvegEit1uXcW4eWSZ1eMFQ18yEyOMN5vg@1iKLc8Ckb3AqVxD5OQR6Ph7Pz@z@F7FISTUe@o7sb9C66yHec8wuco5LWQarcn5NcabQ1j6Ec3t1xJjZZXpjZV8Hk8GYS8EOUQtsDvLx7O6D544Naltq6CLyHsGPPtJQS4YqUSGj62tCv2aKoD@HwCQV/q0tVnfdyUmNWYh7BlANKCn@aghmfwpp@88pJSYLv9HRZYpFhBvaI8zBqV7bHxBNr/SAJCjUcJLfYYS1a0Ap3UFm5EUSoE6lvqJfeFXpXgL6FFaxCl8BaskUxyKTlj8S1Mf8ff57Mp/LpJriGG2Y8Efs7n07tv8WIKQamcBWsKBEULV5mwGHp6fCvaSjEXXa28ll21oXJH9XgAIBHcCQI7Bot1Dis/VkYSDQFRlEwXSRSBN8Ba1isYXLwH2xSpUfaTdj4eG7wL21xiLXJxAsAjARM8YciV7CiykYUkkLHGo5xP1GJL@x9BijTL8XG5kn@fVKFN@VzZ2r2sN82rR4hUZIJ0XCI55JNU1Ay5zLOpqCFyurXbuMa9OgoGSl1AqnU7JpS0aiEgpYcW1CsqBZSlfITGONCIORSm3R20Gf3Y3b4hHx2dU75Z8c1LzXdu7P0D "Perl 6 – Try It Online")
```
{({S:i{.*(<[aeiou]>).*<:L-[_aeiou]><(<![aeiou]>}=$0.lc}...*eq*).tail}
```
[Try it](https://tio.run/##rZLvbtowFMW/@ykuGpuSjHqwSf1AAS2akFqJMVQybVJVTU64Ba@OHeK4QBHPzq4TqHiAKf9zzv353iMXWKrro7MIL9c8u2Es38GHzCwQhsd9sJ/35Z5HweBBoDTucRTyaNCfXD38OX0PgkHrrB2G7S5X2YFzHuE6CnklpDocCfi1QlvBENrR3ZQrqdHy0lSmDD4PR72Q56Lowx74Q/exQ/feI7cutVUZfAnhwJhvLiHADSuU0PCxpt2wJ1OewFcjCNpSF67qtHFbYFbhIoQ9A5AW/CwnNezAm37xygvKgB2O95hjnmIJ1YrSMBtUtsWGI6j/IwkIFZ4ltNhiLFnRCnRSW7gVeaEQqG@pl9wXelWCv4QWtUEUwluwQjLJpeSMxVMY/46/zyZj@HWX3EIMkx8J/JzNxvff4vkYgkI5C9bkCIoWLjNhMfT0eCrqSjETTa28lU21oXJH9XgCIBHcBQIbBov1AlZ@rIwkGgKiKBnPkygCb4CNrFbQ674Hu8tTo@wn7Xw8NngX1rnEWizEBQDPBEzwgiFXsqHIncwlgYw1HuV8ohZr2v8IUqTZAp@WK/n3WeXaFOvSVu5ls929eoRIRSZIxyWSQz5LRc2Qy6xNSQ2R023c1u3cq6NgoNA5pFrXY0JBq@YCUnpoQb2iUkBZyifYGQcacQG5qXcHbUY/drNvyEdH45RvVnzzUvONG1v/AA "Perl 6 – Try It Online")
## Expanded:
```
{  # bare block lambda with implicit parameter $_
  (
    # generate a sequence
    {  # code block used to generate the values
      S               # substitute (not in-place)
      :i              # :ignorecase
      {
          .*              # start at end of string
          ( <[aeiou]> )   # store the previous vowel in $0
          .*
          <:L - [_aeiou]> # letter other than a vowel
          <(              # ignore everything before this
                          # this is where `$0.lc` gets inserted
          # )>            # ignore everything after this
          <![aeiou]>      # not a vowel (zero width lookahead)
      } = $0.lc       # replace with lowercase of the earlier vowel
    }
    ...    # keep generating until:
    * eq * # there are two equal strings (no changes)
  ).tail   # get the last value
}
```
[Answer]
# [Python 3](https://docs.python.org/3/), 125 bytes
```
lambda s,v='[^aeiouAEIOU':sub(f'(?<={v}\W\d])(?={v}]|$)',lambda m:sub(f'{v}]','',s[:m.end()])[-1:].lower(),s)
from re import*
```
[Try it online!](https://tio.run/##bdJtb5swEADg7/kVR7cJiFjWat@ioQpNSK3ULVFK1UlJJplwBK/Yphjndf3t2QFZlpWSIJLj7Ds/drGtMiU/H1J/dsiZiBMG2lv59vQnQ65MEN6OHuyhNrGT2s71F3@/epk9zpK561zXv@e/37u2dxwojnl13PZs29PToRigTBx37k4/Xg3ng1ytsXRcT7u9tFQCSgQuClVW/YMq@ZJLlmvwwbGD7xD@CL6N70J4vI1uIIC7UQQP43E4@Rrch@AUudGglUBo5lwwjdRJD84vO5AJZEhFFpSogUG/H4X3Ub8PdT6seZXB1eUH0FsRq1x/kkbEWGrnnWt15ooyroG@TAJumChyBF2VXC4HnVQWLxJMlxn/9ZQLqYrnUldmtd5sd90OoZACYim79TDPgZbHU9gqAxIxAaFoLRXqqulfW7bbw02Bi4retWqsYWNj1sLxG97SKbIzhIdHPSQ@c@aHbwGSH6N9/SeIfwkxwjNEnvGWkW@54CSptKotDWHSoDc4G00O9c0ka0BZwWpSrJBQ6Si8ZiVVtmDkikskWf7EcypGuupZlVSQhM3abMzW7ExnHVBQGcEgpodknWYwp0@LzU/aeOKmnlpwrMVTVUJ9WD1quwAuYccL53R6m2izI@6wqUL7V@f5PqRN1jFMV0ELrZz0Yl@HrfIFyEBDpWBPA@r/TJ8mu3CbUZhr7Iy3LCucTEYTer6eajiT@2NZis4kl7pCloBK6UVbZSb/K3P4Aw "Python 3 – Try It Online")
Python 3.6 allows us to (ab)use [f-strings](https://www.python.org/dev/peps/pep-0498/) to reuse our set of vowels (and for four more characters saved, the beginning of an inverted regex character class) cheaply (a `f` prefix on each string, then `{v}` as needed, instead of the `'+v+'` you'd need with concatenation, or the `[^aeiouAEIOU` you'd insert literally.
The regex that matches no characters, just a position, avoids issues with the non-overlapping matches normal regexes require, and removes the need to backreference any part of the match; all we use the match object for is to get the slice index we use to find the prior vowel.
Partially de-golfed, it would be something like:
```
import re
def get_last_vowel(string):
    '''
    Returns the lowercase version of the last vowel in a string if
    the string contains any vowels, otherwise, return the empty string
    '''
    try:
        *restvowels, lastvowel = re.sub(r'[^aeiouAEIOU]', '', string)
    except ValueError:
        lastvowel = ''  # No vowels in string
    return lastvowel.lower()
def rememebere_tehe_vowelese(string):
    '''Inserts the lowercased last vowel seen after any consonant not followed by a vowel'''
    return re.sub(r'(?<=[^aeiouAEIOU\W\d])(?=[^aeiouAEIOU]|$)',
                  lambda match: get_last_vowel(string[:match.end()]),
                  string)
```
[Answer]
# TSQL, 500 bytes
```
 CREATE TABLE i (i CHAR(999)); INSERT i VALUES ('The rain in Spain stays mainly in the plain')
 DECLARE @w CHAR(999)=(SELECT i FROM i),@r VARCHAR(999)='';WITH d(n,c,i,q)AS(SELECT n,SUBSTRING(@w,n,1),CHARINDEX(SUBSTRING(@w,n,1),'AEIOUaeiou'),CHARINDEX(SUBSTRING(@w,n,1),'BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz')FROM(SELECT DISTINCT number n FROM master..[spt_values]WHERE number BETWEEN 1 AND LEN(@w))D)SELECT @r=@r+f.c+LOWER(COALESCE(CASE WHEN f.q<>0 AND COALESCE(d2.i,0)=0 THEN SUBSTRING(@w,(SELECT MAX(n)FROM d WHERE i<>0 AND n<f.n),1)END,''))FROM d f LEFT JOIN d d2 ON f.n=d2.n-1 SELECT @r
```
Table `i` is used for [input](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods/5341#5341)
[Answer]
# SWI-Prolog, 593 bytes
```
a(S,D):-atom_chars(S,D).
g(_,[],_,-1).
g(E,[E|_],R,R).
g(E,[_|T],I,R):-N is I+1,g(E,T,N,R).
c(A,E):-g(E,A,0,R),R > -1.
v(X):-a('AEIOUaeiou',X).
c(X):-a('BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz',X).
d([_],_,R,R).
d([H|T],_,I,R):-v(V),c(V,H),!,d(T,H,I,[H|R]).
d([H,N|T],V,I,R):-c(C),c(C,H),v(W),c(W,N),!,d([N|T],V,I,[H|R]).
d([H,N|T],V,I,R):-c(C),c(C,H),v(W),\+c(W,N),string_lower(V,LV),!,d([N|T],V,I,[LV,H|R]).
d([H|T],V,I,R):-!,d(T,V,I,[H|R]).
r([],Z,Z).
r([H|T],Z,A):-r(T,Z,[H|A]).
r(S,D):-r(S,D,[]).
m(X,R):-a(X,O),r(O,P),r([''|P],Q),d(Q,'',I,[]),r(I,J,[]),atomic_list_concat(J,R).
```
Used only built-in predicates (without regex or list manipulating library).
Usage:
```
?- m('A pnm bnn').
'A panama banana'
true .
```
[Answer]
# [Haskell](https://www.haskell.org/), ~~142~~ 130 bytes
```
""&
import Data.Char
v=(`elem`"aeiouAEIOU")
s&(x:y:z)|v y=x:s&(y:z)
s&(x:y)|v x=x:[toLower x]&y|isAlpha x=x:s++s&y|1>0=x:s&y
_&x=x
```
[Try it online!](https://tio.run/##LZBfS@NQEMXf76c4VrckFbv6WqgQakChrkEjCruL3qaT5ur9k83ctIn42Y23ZWEe5vwOwxxOJfmdtB6O11QqSyjxZxiNxkKZ2jUeV9LL6aKSjdjOo1fSZF5HkpRrk/Tm7nEUCx5H3ayffcSfW/Tzbhb0Xv3ne9oF@tu7pdtRg@7vuP9UnOi6kgeHT085oIvL88NxL17GPOfBSGUxh7KeGll4nKC1OuRjTGFkjaiMw3YgQ/IL6XNymy1TPN3k10iwvMvxmGXp/SJ5SBHVumWwMwS9D1FIplgkdo2KGkIRDIbEZJKnD/lkgr2PnfIVLs5/gHuzcpp/2tasqOHoOD4SeaUYYaQFddLUmsC@UXYzFXJVhCY3lXp718a6@l/Dvt3uuv5DJKitwcpakYfGEeKoEr1rYYnWMC5k8cT@8J@PvopSyw0PZ8@LLPsG "Haskell – Try It Online")
The initial `""&` is a partial application of the `(&)` function defined later on, and is placed so oddly to make TIO count the bytes in `""&`, but not count the bytes that, in a full program, would be needed to assign that to any named value.
---
Less golfed: 
```
import Data.Char (isAlpha, toLower)
vowel :: Char -> Bool
vowel = (`elem`"aeiouAEIOU")
replace :: String -> String
replace = go "" -- start by carrying no extra vowel
  where go _ "" = ""
        -- special case for "anything followed by vowel" so later cases can ignore next character
        go s (x:y:more) | vowel y = x : go s (y:more)
        go s (x:xs) | vowel x = x : go [toLower x] xs -- update the vowel we're carrying
                    | isAlpha x = x : s ++ go s xs -- non-vowel letter not followed by a vowel
                    | otherwise = x : go s xs -- some non-letter junk, just include it and carry on
```
There really ought to be a way to do this more concisely with a fold instead of recursion, but I couldn't figure it out.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 34 bytes
```
vyžMylåil©1V}žPylåžM¹N>èå_Y&&i®«}J
```
[Try it online!](https://tio.run/##MzBNTDJM/f@/rPLoPt/KnMNLM3MOrTQMqz26LwDEAwoe2ulnd3jF4aXxkWpqmYfWHVpd6/X/f0hqTo5CbqpCZppCZX6pQl5qaopCbn5RqkJJanGJQnJicWqxIgA "05AB1E – Try It Online")
---
I take that back I can only shave 3 bytes off this monstrosity... I think I could shave the boolean down, but there MUST be 3 cases. 1 for vowels. 1 for consonants. 1 for the case that a digit/symbol exists.
---
```
v                                 # For each...
 y                                # Push current element.
  žM                              # Push lower-case vowels (aeiou).
    ylå                           # Lower-case current element is vowel?
       i©1V}                      # If so, put it in register, set Y to 1.
            žP                    # Push lower-case consonants (b...z)
              ylå                 # Is current char a consonant?
                 žM¹N>èå_         # Push vowels again, is input[N+1] NOT a vowel? 
                         Y        # Did we ever set Y as 1?
                          &&      # All 3 previous conditions true?
                            i®«}  # Concat the current vowel to the current char.
                                J # Join the whole stack.
                                  # '}' isn't needed here, b/c it's implied.
                                  # Implicit return.
```
[Answer]
# Powershell, 104 bytes
based on [Neil's regular expression](https://codegolf.stackexchange.com/a/166373/15968).
```
[regex]::Replace($args,'(?i)(?<=([aeiou]).*?[^\W\d_aeiou])(?![aeiou])',{"$($args.Groups[1])".ToLower()})
```
save it as `get-rememebere.ps1`. Script for testing:
```
$test = @"
AN EXAMPLE WITH A LOT UPPERCASE (plus some lowercase)
And here comes a **TEST** case with 10% symbols/numbers(#)!
This is an example string.
abcdefghijklmnopqrstuvwxyz
A pnm bnn
Tell me if you need more test cases!
"@
$expected = @"
ANa EXAMaPaLE WITiHi A LOTo UPuPEReCASE (pelusu some lowerecase)
Anada here comese a **TESeTe** case witihi 10% siyimiboloso/numuberese(#)!
Thisi isi ana examapale seterinigi.
abacadefegehijikiliminopoqorosotuvuwuxuyuzu
A panama banana
Telele me ifi you neede more tesete casese!
"@
$result = .\get-rememebere.ps1 $test
$result -eq $expected
$result
```
[Answer]
# [Red](http://www.red-lang.org), 276 bytes
```
func[s][v: charset t:"AEIOUaeiou"c: charset 
u:"BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz"b:
parse s[collect[any keep[thru c opt v]keep thru end]]p:""foreach
c b[either find t e: last c: to-string c[p: e][parse c[any[copy p v
| skip]]if find u e[append c lowercase p]]prin c]]
```
[Try it online!](https://tio.run/##TVHLbtswELz7KyYqCiQG@rrqpqRqk9ZJXFtp0hI8UNQqUi2RrEjZUdt8u7NSgMYAD8Q@ZmZnOir2KyqEnJXxvuyNFl6KbQxdqc5TQIijJL24vlFU2z7SL40@jk7PPn76fP7l6@Lyavlttc6@3979@Jnroryvfm2a1rjfnQ/b3cPwJ8rjmRv34IW2TUM6CGUGbIicCFXXQ8O6gK0cK5gqZAopXRxFpe1I6Qp6lguqQ0UdytoUCKAYjfIBLCvYNz50tbmHFi4GSfHMp0ce5nQDHLb4B7@pnZR1@YzBNEI5x1wM39gddVrxFk84BoOWcj9@Akr8Ta6Q3iWXy0WK24vsHAkW1xlulst0dZasUxy7pvfwtiX8Rzp5nL3sMwmLZ0084qEwn2fpOpvPMXHu@DR8eP8afmhz2/h3pm9z6vzxq5OjA5Ssqj34KQN6UK1r2NPp8LcHQ4pTII6hnnKwUxD9lMShHjjTIjfmEJ2aBnwA@zPYHoaoQMv@I9DoM@v0R4/7Jw "Red – Try It Online")
Readable:
```
f: func [ s ] [
   v: charset t: "AEIOUaeiou"
   c: charset u: "BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz"
   b: parse s [
       collect [ any keep [ thru c opt v ]
       keep thru end ]
   ]
   p: "" 
   foreach c b [
       e: last c: to-string c
       either find t e [ p: e ][
           parse c [ any [ copy p v | skip ] ]
           if find u e [ append c lowercase p ]
       ]
       prin c
   ]
]
```
[Answer]
# [Yabasic](http://www.yabasic.de), 180 bytes
A full program which takes input from STDIN and outputs to STDOUT
```
Line Input""s$
x$="AEIOUaeiou"
For i=1To Len(s$)
c$=Mid$(s$,i,1)
?c$;
If InStr(x$,c$)Then
v$=c$
Else
a=Asc(Upper$(c$))
If a>64And a<91And!InStr(x$,Mid$(s$,i+1,1))Then?v$;Fi
Fi
Next
```
[Try it online!](https://tio.run/##PY3RCoIwGIXv/6dY47@Y5I0QQdgSLxQEq4v0AdZcNKg5nIo9/VpdCAfOgcP5zkfchdPS@1obRSpjp5FSh7Agp3lRXVuhdD9RKPuBaJ40PamVYQ4jkMjPusOQYx0nEWQSU6gegXEbB7ZgLDFqnsrAjFwiFC@nQPDcSdZaqwZkoY9@A3Ha73LTEXE8JME3K2DFb5Nw8IdlM6alhqCLWkbvBbHmTe7GfAE "Yabasic – Try It Online")
]