Forum Discussion
Liquid Code to Exclude Generic Emails such as Yahoo and Hotmail
Hello (and help)
I am trying to build liquid code that will exclude users who have non-business email addresses (yahoo, gmail, hotmail etc) and include users with certain words in their job titles
I am using the following which is not working. Any ideas where it is going wrong?
Much appreciated
{% if {{custom_attribute.${job_level}}} matches regex “director” or
{{custom_attribute.${job_level}}} matches regex “ceo” or
{{custom_attribute.${job_level}}} matches regex “SVP” or
{{custom_attribute.${job_level}}} matches regex “Head of” and
{{custom_attribute.${email_address}}} does not match regex “yahoo” or
{{custom_attribute.${email_address}}} does not match regex “gmail” or
{{custom_attribute.${email_address}}} does not match regex “aol” or
{{custom_attribute.${email_address}}} does not match regex “hotmail”
Message to users
{% endif %}
Hey CumberlandStree! "does not match regex" doesn't look like a valid operator. I think you'd need to go with contains in this instance.
Here's a useful guide to Braze supported liquid operators - https://www.braze.com/docs/user_guide/personalization_and_dynamic_content/liquid/operators/
- ConorIrvineSpecialist
Hey CumberlandStree! "does not match regex" doesn't look like a valid operator. I think you'd need to go with contains in this instance.
Here's a useful guide to Braze supported liquid operators - https://www.braze.com/docs/user_guide/personalization_and_dynamic_content/liquid/operators/ - ConorIrvineSpecialist
Also worth adding that this would probably be achieved much cleaner at segment level - not sure if that fits your use case?
- CumberlandStreeActive Member II
Hi - unfortunately, creating a segment does not work in this instance.
Thank you for the link to liquid operators
- bobSpecialist
You'll also have an issue with the and/or precedence in that liquid. They are evaluated left to right - there's no implied parentheses. You might need to nest the if statements to get the effect you're thinking of.
The solution doesn't feel great though. I'd suggest some of this logic should be maintained in your CDP (or whatever you have that feeds data into Braze) - then pass cleaner attributes that you can more easily use for segmentation/personalisation.
Related Content
- 9 months ago