You can use the wildcard asterisk (*) character to achieve pattern matching for rewriting.
You cannot specify just an * in the valuePatterns field. Because * indicates a match with all text, no text follows the valuePattern. Therefore, Rewriter has no text to rewrite. You must use * in conjunction with another string such as *abc. In this case, all content that follows *abc is rewritten.
An asterisk (*) can be used as a wildcard in any of the fields of the rule. However, all the fields in the rule cannot contain an *. If all fields contain a *, the rule is ignored. No error message is displayed.
You can use a * or ** along with the separation character (a semicolon or comma) that displays in the original statement to separate multiple fields. One asterisk (*) matches any field that is not to be rewritten, and two asterisks (**) to match any field that needs to be rewritten.
Using Wild Cards in valuePatterns lists some sample usages of the * wildcard.
Table 4–1 Sample Usage of * Wildcard
URL |
valuePatterns |
Description |
---|---|---|
url1, url2, url3, url4 |
valuePatterns = "**, *, **, *" |
url1 and url3 are rewritten because ** indicates the portion to be rewritten |
XYZABChttp://host1.sesta.com/dir1.html |
valuePatterns = "*ABC" |
only the portion http://host1.sesta.com/dir1.html is rewritten. Everything after *ABC needs to be rewritten. |
"0|dir1|dir2|dir3|dir4|test|url1 |
valuePatterns = "*|*|**|*|**|*|" |
dir2, dir4 and url1 are rewritten. The last field that needs to be rewritten does not have to be indicated by using **. |