You are viewing a single comment's thread. Return to all 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. */
Seems like cookies are disabled on this browser, please enable them to open this website
Weather Observation Station 6
You are viewing a single comment's thread. Return to all 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. */