Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Quiz quest in ESCAPE HATCHES tut wrong. Question: If I want to match the character Ö, which escape sequence should I Use
the Ö character is not a unicode character and therefore regex would match this using \W and NOT \w like your answer says.
Here is what your answer says when answering it CORRECTLY.
Bummer! \W matches anything that isn't an Unicode word character, so it would actually ignore the above character. \w will match the code, though.
The quiz has the correct answer.
In the cases of characters(
\s), and decimals(
\d) the lowercase escape matches the category. While the uppercase escape would match the absence of a unicode category.
https://docs.python.org/3/library/re.html has a useful cheat sheet in the first section
Anthony Attard43,915 Points
Ö is an UTF-8 character. The character code is
You can view more details here: http://www.periodni.com/unicode_utf-8_encoding.html#german_special_characters
Ö with the to dots above the "0" is not a unicode character, therefore the NON-unicode character "Ö" would be matched with \W (uppercase W).
This is why I'm so confused.
In one of the previous lessons the teacher said: "\w matches any Unicode word character, which is any letter, digit and underscore. ( a-Z,1-9,_ )
When I go to http://regexpal.com/, if I type in \W (uppercase), it matches Ö. Lowercase \w does not match. Here's a screenshot on Regexpal.com showing that it matches \W (uppercase). Here's a screenshot: https://www.dropbox.com/s/jwfyc1flrxtediq/regex-uppercase-w.png?dl=0
Well said Adam.
I'll put that in my regex notes. Thanks for taking the time to help me figure that out.