Fortinet 383 FortiWeb 5.0 Patch 6 Administration Guide
replacement text. By omitting a capture group (in this case, $1 is omitted from Replacement),
that part of the text is removed. To insert text, simply add it to the replacement text.
See also
Regular expression syntax
What are back-references?
Cookbook regular expressions
Example: Rewriting URLs using regular expressions
Example.edu is a large university. Professors use a mixture of WordPress and Movable Type
software for their course web pages to keep students updated. In addition, the campus
bookstore and software store use custom shopping cart software. The URLs of these web
applications contain clues about the underlying vendors, databases and scripting languages.
The university is a frequent target of attacks because it is a large organization with many mobile
users and guests, and an Internet connection with large bandwidth. Its network administrators
want to hide the underlying technology to make it more difficult for attackers to craft
platform-specific attacks. Example.edu also wants to make clients’ bookmarked URLs more
permanent, so that clients will not need to repair them if the university switches software
vendors.
Because it has so many URLs, the university uses regular expressions to rewrite sets of similar
URLs, rather than configuring rewrites for each URL individually. More specific URL rewrite rules
Table 39:Example body rewrite using regular expressions
Object HTTP Body
Regular Expression in URL
match condition
(.*)(everyone), (.*)(works)!
Replacement $0, $2 $3 now!
Capture group 0
Capture group 1 Capture group 2
Capture group 3