116
Using back references
HomeSite supports back referencing, which allows you to match text in previously
matched sets of parentheses. You can use a slash followed by a digit n (\n) to refer to
the n
th
parenthesized subexpression.
One example of how you can use back references is searching for doubled words, for
example, to find instances of "is is" or "the the" in text. The following example shows
the syntax you use for back referencing in regular expressions:
("There is is coffee in the the kitchen",
"([A-Za-z]+)[ ]+\1","*","ALL")
This code searches for words that are all letters ([A-Za-z]+) followed by one or more
spaces [ ]+ followed by the first matched subexpression in parentheses. The parser
detects the two occurrences of is as well as the two occurrences of the and replaces
them with an asterisk, resulting in the following text:
There * coffee in * kitchen
Anchoring a regular expression to a string
You can anchor part of a regular expression to either the beginning or end of the string
being searched:
•
If a caret (^) is at the beginning of a subexpression, the matched string must be
at the beginning of the string being searched.
•
If a dollar sign ($) is at the end of a subexpression, the matched string must be
at the end of the string being searched.
Содержание COLDFUSION STUDIO 4.5-USING COLDFUSION...
Страница 1: ...Allaire Corporation Using ColdFusion Studio ColdFusion Studio 4 5 for Windows 95 98 NT4 2000...
Страница 16: ...xvi Contacting Allaire...
Страница 90: ...82...
Страница 130: ...122...
Страница 133: ...141 Two VTML tags CAT and E let you customize the content of these dialog boxes...
Страница 182: ...190...