Weather Observation Station 9

  • + 36 comments

    MySQL solution

    From my HackerRank solutions.

    SELECT DISTINCT CITY FROM STATION
    WHERE CITY REGEXP '^[^aeiou]';
    

    Putting a ^ inside the closed bracket means something completely different than putting it outside the brackets. Putting it inside the brackets makes it match all characters EXCEPT the ones inside the bracket. So instead of writing [bcdfghjklmnpqrstvwxyz], we can write [^aeiou]