Grabbing event property values in a string using Regex


Hi everybody, 

We are facing some issues with this data and hope someone can help us. 

So we have an event in heap named: Filter Applied, that captures the filter applied by users on the experience. The filter has multiple option:

  • Document type: if you want to filter your Statement only, Statements & Reports, etc. So you can select multiple options
  • Timeframe: 2022, 2023 and 2024. Similarly, you can select multiple options

We do have a property called: filtername that returns what filters have been applied by the users. However, when we get the data back in a chart, each combination of filter comes as a unique value. For example below:

DOCTYPE [Statements & Reports], TIMEFRAME [2023]  12

DOCTYPE [Statements & Reports], TIMEFRAME [2023,2022]   23

DOCTYPE [Statements], TIMEFRAME [2024, 2023]      40

And we want to create a property that will grab the Category (in uppercase), and the Value (within the square bracket) as follow:

  • Property 1: Filter Category: DOCTYPE, TIMEFRAME
  • Property 2: Filter Value: 2022, 2023, 2024

Using Regex, we were only able to grab what is in the first square bracket, but it does not look at everything. Plus, what is within the bracket will still come as a unique value, and we will end up with each combination again as a unique value (eg: [2023, 2022], [2024,2023].)


Any chance someone might encounter similar issue as well?


0 replies

Be the first to reply!