Weather Observation Station 6

  • + 0 comments

    /* SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP '^[aeiouAEIOU]'

    What ^ and $ mean in regex

    ^ → anchors the match to the start of the string.

    $ → anchors the match to the end of the string.

    So:

    ^A → means the string starts with A.

    A$ → means the string ends with A.

    ^A$ → means the string is exactly just "A", no more, no less.

    What [] means

    Square brackets [...] let you define a set of characters.

    The regex will match any one character from inside the brackets.

    [abc] → matches a, b, or c (just one character).

    "cat" (matches c)

    "bat" (matches b)

    "dog" (no match at first character).

    [0-9] → matches any single digit from 0 to 9.

    [A-Z] → matches any uppercase letter.

    [a-zA-Z] → matches any uppercase or lowercase letter. */