11. Metacharacters - The Character Class
- Here's the result:
It is full of words with the letter "q" in them.
Some words, like qintar, do not have a u after the q.
Other words, like quartet, do have the letter u after the q!
and some other special words, like Iraqi, and last but not least,
- What?? Where is the line with "Qantas" and "Iraq"? Why aren't
they there?
- Well, Qantas doesn't match with that regex, because we asked
for a lower case "q", and Qantas has an upper case "Q"!
- However, the line with Iraq in it is a little more obscure.
While it does have the lower case "q" we asked for, that lower
case "q" is the last character in the file, and so the
[^u]
can't match!
- Remember, it's trying to match any single character that is not
the literal "u", so there must be some character to match!
- Negation of a character class is not the same thing as matching
nothing in place of the class!
|