use a regex and a single replace to match duplicate tags