Creating A Multi-Character Regular Expression; Using A Back Reference - MACROMEDIA HOMESITE Using Manual

For windows 98, windows me, windows nt 4.0, windows 2000, and windows xp
Table of Contents

Advertisement

110

Creating a multi-character regular expression

You can use the following rules to build multi-character regular expressions:
• Parentheses group parts of regular expressions together into grouped
• A one-character regular expression or grouped subexpressions followed by an
• A one-character regular expression or grouped subexpressions followed by a plus
• A one-character regular expression or grouped subexpressions followed by a
• The concatenation of regular expressions creates a regular expression that
• The OR character (|) allows a choice between two regular expressions. For
• Braces ({}) are used to indicate a range of occurrences of a regular expression, in

Using a back reference

HomeSite+ for Dreamweaver MX supports back referencing, which allows you to
match text in previously matched sets of parentheses. You can use a backslash
followed by a digit n (\n) to refer to the n
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",
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
subexpressions that can be treated as a single unit. For example, (ha)+ matches
one or more instances of "ha".
asterisk (*) matches zero or more occurrences of the regular expression. For
example, [a-z]* matches zero or more lowercase characters.
(+) matches one or more occurrences of the regular expression. For example,
[a-z]+ matches one or more lowercase characters.
question mark (?) matches zero or one occurrences of the regular expression. For
example,
matches either "xyz" or "xz".
xy?z
matches the corresponding concatenation of strings. For example, [A-Z][a-z]*
matches any word, regardless of case.
example, jell(y|ies) matches either "jelly" or "jellies".
the form {m, n} where m is a positive integer equal to or greater than zero
indicating the start of the range and n is equal to or greater than m, indicating the
end of the range. For example, (ba){0,3} matches up to three pairs of the
expression "ba".
"([A-Za-z]+)[ ]+\1","*","ALL")
Chapter 7 Using Web Development Languages
th
parenthesized subexpression.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Homesite+ for dreamweaver mx

Table of Contents