Good Morning, I currently have a flow that relies on pulling the Klaviyo ID from customer tags in Shopify. The problem I'm running into is that most customers have multiple tags which makes it difficult to extract the correct tag which starts with "Klaviyo ID:" for example "Klaviyo ID: 01G1TZJE4G2PYFW01AFCSD46N8". I would like to extract the tag that starts with "Klaviyo ID: " and only use the value after that.
Hi @shadnerjoseph
You can add a transformation to extract the value of the Klaviyo ID. sample screenshot below.
{{substring tags (regexSearch tags 'Klaviyo ID:([^\\s]+)') (add (regexSearch tags 'Klaviyo ID:([^\\s]+)') 38)}}
@shadnerjoseph to build on @sreevaniamara's response, if you don't want the "Klaviyo ID: " piece of the string, since I assume you need just the id to map to Klaviyo, you can use the below handlebar expression. This will extract just the id, works if the tag is beginning, middle, or end of the tag string, and doesn't rely on hardcoded string lengths in case something changes down the road.
{{regexMatch tags "(?<=Klaviyo ID: )([A-Za-z0-9_-]+)" 0 "g"}}