You can use the * character to achieve pattern matching for rewriting.
You cannot specify just a * in the valuePatterns field. Because * indicates a match with everything, nothing will follow the valuePattern, and hence Rewriter will have nothing left to rewrite. You can 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. But all the fields in the rule cannot contain a *. 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 wildcard (*) matches any field that is not to be rewritten, and two wildcards (**) match any field that needs to be rewritten.
Using Wild Cards in valuePatterns lists some sample usages of the * wildcard.
Table 3–1 Sample Usage of * Wildcard
URL |
valuePatterns |
Description |
---|---|---|
url1, url2, url3, url4 |
valuePatterns = "**, *, **, *" |
In this case, url1 and url3 are rewritten because ** indicates the portion to be rewritten |
XYZABChttp://host1.sesta.com/dir1.html |
valuePatterns = "*ABC" |
In this case, 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 = "*|*|**|*|**|*|" |
In this case, dir2, dir4 and url1 are rewritten. The last field that needs to be rewritten does not have to be indicated by using **. |