Quote:
	
	
		| 
					Originally Posted by ownedbycats  I'd like to replace my 'Add Cleanup tag' and 'Remove Cleanup tag' action chains with a single one that toggles it. 
	Code: program:
	if 
		'[Cleanup]' inlist $tags 
	then 
		list_difference($tags,'[Cleanup]' , ',') 
	else
		list_union($tags,'[Cleanup]' , ',')
	fi Line 8 is failing - it works on its own, so the mistake is something with the conditions. What did I do wrong? | 
	
 The left side of the inlist operator is a regular expression. Brackets open a character class, so your 'if' is asking if any of the letters c, l, e, a, etc are in the tag. Use '\[Cleanup\]' to avoid the character class.
If the tag is actually the string '[Cleanup]', which your list_... expressions imply, then you can use the str_in_list() function to avoid regular expressions. Something like
	Code:
	program:
	if 
		str_in_list($tags, ',', '[Cleanup]', 1, '')
	then 
		list_difference($tags,'[Cleanup]' , ',') 
	else
		list_union($tags,'[Cleanup]' , ',')
	fi
 This form is likely to be faster.