In this HackerRank Day 7: Regular Expressions I 10 days of javascript problem solution Complete the function in the editor below by returning a RegExp object, re, that matches any string s that begins and ends with the same vowel. Recall that the English vowels are a, e, i, o, and u.

HackerRank Day 7: Regular Expressions I problem solution


Problem solution in JavaScript programming.

function regexVar() {
    /*
     * Declare a RegExp object variable named 're'
     * It must match a string that starts and ends with the same vowel (i.e., {a, e, i, o, u})
     */
    const re = new RegExp("^([aeiou]).*\\1$");
    
    /*
     * Do not remove the return statement
     */
    return re;
}