All right. The next question I would like to address deals with internationalization.
In reality, web browsers like Firefox or Internet Explorer can handle words,
strings, sentences in language other than English.
The question from students is, basically, how does that work? What's up with that?
To answer that fully, I need to take a little aside into how we even represent English characters.
It turns out that it's totally arbitrary.
We're essentially going to use numbers under the hood.
Computers can already manipulate numbers. Let's say we believe that's possible.
A computer file could just be a big list of numbers.
Well, we're all going to agree on a standard that certain numbers stand for certain letters.
This standard is totally arbitrary.
For example, the decimal number 65 stands for uppercase English "A."
The decimal number 66 is uppercase English "B."
Why did we start at 65? Why not?
This standard is called ASCII--the American Standard Code for Information Interchange.
There are 256 possible number to letter conversions in it.
We only need 52 of those for the alphabet--26 lowercase letters, 26 uppercase letters--
but there are also spaces, periods, parentheses, all of the number signs, multiplication,
division, quotes, that sort of thing.
Then the remainder is sort of filled out with special characters that aren't typically printed--
like new line character that we've been escape sequences for.
Two hundred fifty six might seem like a lot of room,
since we're really only using maybe 80 of them,
but it is not enough to encode--for example--all Chinese characters or ideograms
or all of the other scripts that exist in the world from Greek or Cyrillic or Tagalog,
which I believe has a different alphabet.
Someone will correct me on this one. Make it known in the forums.
Anyway, there are a bunch of different scripts used in natural languages,
and there are more than 256 characters in the entire world.
The basic solution is we need more numbers.
Rather than saying that numbers 1 through 256 correspond to letters,
we'll just decide to use more room.
We'll say numbers between 1 and 65,536 correspond to letters.
Maybe the ones at the beginning correspond to English.
Then there's some for Greek. Then there's some for Russian.
It's just a bigger standard. Somehow we have to agree on the order in which they appear.
You may have heard words like Unicode or UTF8 mentioned in this sort of discussion.
Those are just standards for using bigger sequences of numbers to represent letters
that occur in the natural languages throughout the world.
All right. Let's get back now to the meat of the question.
How does a web browser like Firefox handle words written in other languages,
especially if you're doing token definitions or whatnot.
Essentially, as a convenience feature for programmers like you,
we've written out A through Z--or a through z, capital A through capital Z--
to mean I want this to be a word, but often there are special shortcuts,
like \w, which you can write down--kind of like we might write down
\n for new line, \w often means this is a word character.
Someone else at the standards committee once and for all has written down all of the numbers
corresponding to English letters, Cyrillic letters, Latin letters, Greek letters,
all the way on down, including a bunch of Chinese, Japanese, Korean ideograms,
or letters in their syllabaries, and listed all of the ones that don't correspond
to space or punctuation in essentially a big lookup table.
Then whenever you want to say I want to get a word in any language,
you just refer to something like \w.
You refer to this lookup table, often provided by a library for you,
and it expands under the hood to actually thousands of individual characters
or character ranges.
In practice--one again, the answer to this is someone in one particular standards committee
essentially enumerated every possible letter, every possible script sequence ,
in all of human natural languages--or at least all of the ones that we have thus far
encountered or codified--and we've written down which of those correspond
to word letters and which of them correspond to number.
Then we provide special shortcuts that you can use to reference those sets.
So when a Firefox developer is writing a regular expression,
instead of using A through Z if they mean it's part of a word,
they'll use something special like \w.
The actual name for this escape sequence is different depending on which regular expression
library you're using, but the basic concepts--
parenthesis grouping, plus, star--they stay the same for the Firefox developers
even if you're supporting multiple international languages.