MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Spezifikationen Seite 370

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 504
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 369
370 Server Behaviors
The search string is defined as a regular expression by starting and ending with a slash (/) and
is followed by
i, which means that it is not case-sensitive. Within the regular expression,
special characters such as parentheses () and periods (.) are escaped by preceding them with a
backslash (\). The two parameters
rs and new__url are extracted from the string by using
parenthetical subexpressions (the parameters must be enclosed in parentheses). In this
example, they are indicated by
(\w+) and ([^\r\n]*): These values correspond to the
regular expression values that are normally returned by
$1 and $2.
Optional search patterns There might be cases where you want to identify a participant
even if some parameters are not found. You might have a participant that stores some optional
information such as a telephone number. For such an example, you could use the following
ASP code:
<% //address block
LNAME = "joe";
FNAME = "smith";
PHONE = "123-4567";
%>
You could use the following search patterns:
<quickSearch>address</quickSearch>
<searchPatterns whereToSearch="directive">
<searchPattern paramNames="lname">/LNAME\s*=\s*"([^\r\n]*)"/i¬
</searchPattern>
<searchPattern paramNames="fname">/FNAME\s*=\s*"([^\r\n]*)"/i¬
</searchPattern>
<searchPattern paramNames="phone">/PHONE\s*=\s*"([^\r\n]*)"/i¬
</searchPattern>
</searchPatterns>
In the previous example, the telephone number must be specified. However, you can make
the telephone number optional, by adding the
isOptional attribute, as shown in the
following example:
<quickSearch>address</quickSearch>
<searchPatterns whereToSearch="directive">
<searchPattern paramNames="lname">/LNAME\s*=\s*"([^\r\n]*)"/i¬
</searchPattern>
<searchPattern paramNames="fname">/FNAME\s*=\s*"([^\r\n]*)"/i¬
</searchPattern>
<searchPattern paramNames="phone" isOptional="true">¬
/PHONE\s*=\s*"([^\r\n]*)"/i
</searchPattern>
</searchPatterns>
Now the participant is recognized, even if the telephone number is not found.
Seitenansicht 369
1 2 ... 365 366 367 368 369 370 371 372 373 374 375 ... 503 504

Kommentare zu diesen Handbüchern

Keine Kommentare