Search-and-replace filters

Use Search-and-replace Filters to replace a matched expression with another string. They require a filter field, an expression to search for, and a replace expression. The search expression is a regular expression, while the replace expression is any text that you wish to use to replace the original text.

For example, you can use Search-and-replace filters to remove a leading directory from your reports. To do so, select the Request URI field and enter ^/directory/ in the Search String field. The Replace String would then be /.

Another use would be to replace category ID numbers with descriptive words in the query string of a request. For example, suppose that samples of the requested file with attached queries look like:

/docs/document.cgi?id=1000
/docs/document.cgi?id=2000

Using the search and replace filter, you could convert the 1000 or 2000 IDs to readable equivalents. For example, 1000 could be changed to books, and 2000 changed to magazines. This would make your reports more useful to people who are not familiar with the individual ID codes.

You can also use these filters to consolidate data. For example, if you're getting hits from two different hostnames that represent the same page (e.g., www.example.com and example.com), then you can use a Search-and-replace filter to consolidate all those hits under a single hostname. In this case, you could create the following filter to strip www and have all hits attributed to example.com:

  • Filter Field: Hostname
  • Search String: ^www.
  • Replace String: <leave this field blank>

For an overview of filters, read About view filters.

How helpful is this article:

Feedback recorded. Thanks!
  • Not at all helpful
  • Not very helpful
  • Somewhat helpful
  • Very helpful
  • Extremely helpful