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

Lookahead and Lookbehind

Figure 8-12

Negative Lookbehind

Negative lookbehind is a constraint on matching. Matching occurs only if the pattern to be matched is not preceded by the pattern contained in the lookbehind assertion.

Try It Out

Negative Lookbehind

Find occurrences of the character sequence SQL Server that are not preceded by the character sequence like followed by a space character.

1.Open RegexBuddy, click the Match tab, and enter the regular expression (?<!like )SQL Server.

2.Click the Test tab, click the Open File icon, and open the Databases.txt file.

3.Click the Find First icon, and inspect the highlighted text in the pane in the Test tab, as shown in Figure 8-13.

4.Look for other matches by clicking the Find Next icon several times. Note which occurrences of SQL Server match or don’t match.

213