This online section is available via the book’s Companion Website at
In this section, we introduce regular expressions—specially formatted strings used to find patterns in text. They can be used to ensure that data is in a particular format. For example, a U.S. zip code must consist of five digits, or five digits followed by a dash followed by four more digits. Compilers use regular expressions to validate program syntax. If the program code does not match the regular expression, the compiler indicates that there’s a syntax error. We discuss classes
Match from the
System.Text.RegularExpressions namespace as well as the symbols used to form regular expressions. ...