Sort by

recency

|

174 Discussions

|

  • + 0 comments

    my regex: const re = /^([aeiou])\w*\1$/;

    passes all the sample test provided because the sample test are all 3 letter strings but it should fail the constraint: **'' The length of string s is >= 3" **

    better regex: const re = /^([aeiou]).+\1$/;

    the above regex checks for above constrain.

  • + 0 comments

    quickest possible way ik

    function regexVar() {
        return /^([aeiou]).*\1$/;
    }
    
  • + 1 comment
    const re = /^a.*a$|^e.*e$|^i.*i$|^o.*o$|^u.*u$/;
    

    im sure there's a quicker way to do it

  • + 0 comments

    This problem in my opinion, appears silly. The s is mentioned as though it is a parameter variable yet it is not. Since it is not, the question remains is where the s is a local variable. I have tried using it in few different ways but I keep failing at it every try.

    However, after tweaking the problem like the one below, I was able to get the function working properly: this problem works as described in the specification.

    /**In this vowelRegExpression() function - the goal is to compare the first and last character in a string. If the * first and last characters are vowel then return true; otherwise return false. */

    function vowelRegExpression(str){ let strs=/[aeiou]/; let t=false; if(str.charAt(0)==str.charAt(str.length - 1)){ t=strs.test(str);

    } return t; } document.write(vowelRegExpression('ende'));

  • + 0 comments
     let re = new RegExp("^([aeiou])[a-z]*\\1$");