How can I extract a specific tag from a list of tags?
You can use the search_list() function to search a list of tags and output the matching results:
search_list(to_list({{ tags }}), "men")
The above example will check each tag if it contains the characters "men" and ouput the entire tag if true. If there are multiple matches, the function will return all of them separated by a comma.
To check for an exact match, simply add the parameter exact_match=True
:
search_list(to_list({{ tags }}), "men", exact_match=True)
More Advanced Comparisons
For more advanced comparisons, such as checking if a tag starts with or ends with certain characters, we can us a "for loop" via a "list comprehension" syntax (this is a Python programming concept).
This allows us to do more advanced filteriing by using conditional logic inside the loop.
Example 1:
Only output tags that start with "gender:":
",".join([i for i in to_list({{ tags }}) if i.startswith("gender:")])
Example 2:
Only output tags that start with "New_" or "BrandNew_", and contains the characters "oos":
",".join([i for i in to_list({{ tags }}) if (i.startswith("New_") or i.starswith("BrandNew_")) and "oos" in i)])
App: EZ Exporter
Tags: advanced features