i don't know if you use regex, but you could do a replace. \[/?color.*?\] using single line and ignore case options It selects both just and