Use regex from machine_tag to validate tags, and add more tests