Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Beginning Regular Expressions 2005.pdf
Скачиваний:
95
Добавлен:
17.08.2013
Размер:
25.42 Mб
Скачать

Chapter 4

Case-Insensitive Search

The Star Training Company example in Chapter 1 showed a situation where a case-insensitive search produced results that weren’t what was wanted. However, there are occasions when you will want to search using a case-insensitive search. For example, a list of part numbers might require that any alphabetic characters in a part number be uppercase. A case-sensitive search would identify part numbers with a lowercase character inappropriately used. A case-insensitive search would fail to identify such malformed part numbers.

In OpenOffice.org Writer, the Match Case check box is used to specify a case-sensitive search.

Exercises

The following questions and exercises are intended to help you test what you have learned in this chapter.

1.What is the difference between the . (period) metacharacter and the \w metacharacter?

2.Modify the regular expression pattern in CheckWhitespace.html so that it will match strings that allow whitespace on both sides of the = character that separates the name and value of the

DateOfBirth attribute.

104