I’m pretty new to Amplitude and not very experienced with regular expressions, hoping for some help with my formula please.
Background:
We operate overlay or banner ads on our website and, in this case, when a user clicks on one of these call to action buttons we pass a utm_content parameter which contains “yield” in the query string of the destination URL.
I have something incorrect, a combination of a incorrect regular expression for “Contains” using REGEXEXTRACT, and/or my logic is incorrect with the statement.
Here’s the Formula I currently have:
IF(
REGEXEXTRACT(utm_content, "/yield") == "yield",
'true',
'false'
)
When I create this Derived Property and select it, I only receive “false” as a filter option - so the function is incorrect and never resolves as true.
Now, if I use a straight utm_content property then I can see all the campaigns where this occurs:
Many thanks!
Hey
@bward
Looks like the regex formula is trying to match a “/” at the start of “yield” and the possible values in the utm_content property only start with “yield” in the property dropdown screenshot.
Also, if your value contains a “/” , the right way to try matching that would be to escape the value using a backslash “\” at the start of a “/”. You can also try using a “^” in the pattern if you want to match a string at the beginning of each value.
Can you try using REGEXEXTRACT(utm_content, "yield") == "yield" and see if that works?
Scanning file for viruses.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
This file cannot be downloaded
Sorry, our virus scanner detected that this file isn't safe to download.