Reverse vowels in a string, using regex
<p>I am working on an algorithm that takes in a string for input, and reverses the vowels of the string.</p>

<ul>
<li>'hello' should return as 'holle' </li>
<li>'wookiE' should return as 'wEikoo'</li>
</ul>

<p>Could <code>str.replace</code> be used as a solution?</p>

<pre><code>function reverseVowels(str) {
    return str.replace(/[aeiou]/-g, /[aeiou]+1/);
}
</code></pre>

<p>I am not sure what the second parameter for the <code>replace</code> function would be. I intended to find the first vowel and then move on to the next one to replace it with. Can this be done just with this method or is a <code>forEach</code>/<code>for</code> loop needed?</p>