The Personal Web Pages of Chris X. EdwardsRegular Expression Tutorial |
The period, which is usually called the "dot", is the symbol used in regular expressions to signify the comprehensive character class. A comprehensive character class is simply the complete collection of all characters. The word comprehensive means "including everything" and the period will match any character.
Because the dot will match any character, fun and hilarity are often the result of operations where a literal period is to be searched for. For example, if I look for /a.k.a./ in my text, I might find this pattern in the words "backlash", "awkward", "hacksaw", "Falkland", etc. Each of these words contains "a", something, "k", something, "a", and something. The correct way to search for literal periods is to use backslashes to make them literal. /a\.k\.a\./ will produce the correct match.
Previous | Home | Next |
This page was created with only free, open-source, publicly licensed software. This page was designed to be viewed with any browser on any system. | ||
Chris X. Edwards ~ December 2003 |