<searchPattern>
Description
This tag is a pattern that identifies participant text and extracts parameter values from it. Each parameter subexpression must be enclosed in parentheses ().
You can have patterns with no parameters (which are used to identify participant text), patterns with one parameter, or patterns with many parameters. All non-optional patterns must be found, and each parameter must be named and found exactly once.
For more information about using the searchPattern tag, see Finding server behaviors.
Parent
searchPatterns
Type
Block tag.
Required
Yes.
Values
searchString, /regularExpression/, <empty>
- The
searchStringvalue 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
optionLabelparameter to the entireinnerHTMLcontents of anOPTIONtag.