User Guide
Using regular expressions 107
Using regular expressions
This section describes regular expressions and provides information and examples
for using them in HomeSite+ for Dreamweaver MX.
About regular expressions
A regular expression is a pattern that defines a set of character strings. The RegExp
parser in HomeSite+ for Dreamweaver MX evaluates the indicated text and returns
each matching pattern.
As in arithmetic expressions, you can use various operators to combine smaller
expressions and basic regular expressions can be concatenated into complex criteria.
For more information, see “Anchoring a regular expression to a string” on page 111.
In HomeSite+ for Dreamweaver MX, you can use regular expressions for extended
searches and validating code:
• Extended search Search a document for a pattern rather than a specific string
of characters. For example, search for repeated words with
(" [A-Za-z] "){2,}.
In an extended search, all matches are added to the list of results. But in an
extended search and replace, matches are immediately replaced with the
replacement text. So consider not only what is matched but what is not matched;
for example, there might be two or more strings that you must replace with the
same text. Also, it is always a good idea to back up your files first!
In a search and replace operation, the RegExp engine processes the entire
document; it does not parse on a line-by-line basis. This affects the way that you
should use characters such the asterisk (*), carat (^), and dollar sign ($).
• Code validation Define a special requirement for your code in the validator.
For example, set the validator to search for (and flag as an error) any user input
box that does not have an associated error message.
For more information, see “Using extended search commands” on page 176 and
“Validating code” on page 120.
Writing regular expressions
The rules listed in this section are for creating regular expressions in HomeSite+ for
Dreamweaver MX; the rules used by other RegExp parsers might differ.
To construct a regular expression in Expression Builder:
1 Select Tools > Insert Expression.
2 In the Expression Builder dialog box, in the tree pane, navigate to Expression
Elements > Constants > Regular Expressions.
3 (Optional) For syntax and usage information for a regular expression, click the
regular expression in the right pane and press F1.
4 Double-click a regular expression in the right pane.










