Search/Replace Value

uses `regex` to do a global search/replace in the key specified by "key"

The Search/Replace Value action uses regex to do a global search and replace in the key specified by key. When applied to your processing rule, the Search/Replace Value action finds any occurrence of a specified regex in a key pattern, and replaces them in place.

For example, given the following sample website log data:

{"timestamp":"2023-03-28T09:08:41.64283645Z","user_id":3,"page_id":30,"action":"purchase"}
{"timestamp":"2023-03-28T09:08:42.643343109Z","user_id":4,"page_id":10,"action":"purchase"}
{"timestamp":"2023-03-28T09:08:48.643600498Z","user_id":1,"page_id":50,"action":"click"}
{"timestamp":"2023-03-28T09:08:50.643773688Z","user_id":5,"page_id":40,"action":"purchase"}
{"timestamp":"2023-03-28T09:08:51.643932272Z","user_id":1,"page_id":30,"action":"purchase"}
{"timestamp":"2023-03-28T09:08:56.644080944Z","user_id":2,"page_id":40,"action":"click"}
{"timestamp":"2023-03-28T09:09:03.64425954Z","user_id":3,"page_id":30,"action":"click"}
{"timestamp":"2023-03-28T09:09:03.644317046Z","user_id":1,"page_id":20,"action":"view"}
{"timestamp":"2023-03-28T09:09:10.64447719Z","user_id":2,"page_id":50,"action":"purchase"}
{"timestamp":"2023-03-28T09:09:17.644810963Z","user_id":2,"page_id":10,"action":"view"}
{"timestamp":"2023-03-28T09:09:20.644994805Z","user_id":1,"page_id":50,"action":"view"}

To replace every occurrence of the click value in the action key with view:

  1. In the processing rules tab, in the Actions dropdown, select Search/Replace value.

  2. In the Key field, enter action.

  3. In the Regex field, enter click.

  4. In the Maximum number of substitutions field, enter a limit on the number of substitutions you want in your pipeline.

  5. In the Replacement field, enter view.

  6. Click Apply.

Your processing rule will replace instances of the value click with the value view, wherever the click value is found in the action key.

Last updated