Searchpattern> attributes – Adobe Extending Dreamweaver CS4 User Manual

Page 277

Advertising
background image

271

EXTENDING DREAMWEAVER CS4

Server behaviors

Parent

searchPatterns

Type
Block tag.

Required
Yes.

Values
searchString, /regularExpression/, <empty>

The searchString value is a simple search string that is case-sensitive. It cannot be used to extract parameters.

The /regularExpression/ value is a regular expression search pattern.

The <empty> value is used if no pattern is given. It is always considered a match, and the entire value is assigned to
the first parameter.

In the following example, to identify the participant text

<%= RS1.Field.Items("author_id") %>

, you can define

a simple pattern, followed by a precise pattern that also extracts the two parameter values:

<searchPattern>Field.Items</searchPattern>

<searchPattern paramNames="rs,col">

<![CDATA[
/<%=\s*(\w+)\.Field\.Items\("(\w+)"\)/
]]>

</searchPattern>

This example matches the pattern precisely and assigns the value of the first subexpression (

\w+

) to parameter

rs

and

the second subexpression (

\w+

) to parameter

col

.

Note: It is important that regular expressions start and end with a slash (/). Otherwise, the expression is used as a literal
string search. Regular expressions can be followed by the regular-expression modifier

i

to indicate case-insensitivity (as

in

/pattern/i

). For example, VBScript is not case-sensitive, so it should use

/pattern/i

. JavaScript is case-sensitive

and should use

/pattern/

.

Sometimes you might want to assign the entire contents of the limited search location to a parameter. In that case,
provide no pattern, as shown in the following example:

<searchPatterns whereToSearch="tag+OPTION">

<searchPattern>MY_OPTION_NAME</searchPattern>
<searchPattern paramNames="optionLabel" limitSearch="innerOnly">
</searchPattern>

</searchPatterns>

This example sets the

optionLabel

parameter to the entire

innerHTML

contents of an

OPTION

tag.

<searchPattern> attributes

The following items are valid attributes of the

searchPattern

tag.

Advertising
This manual is related to the following products: