added pattern support for generate-tag function