@chrisbiscardi Chris, you pointed me in the right direction. My logic is technically correct, but since I'm reverse engineering another applications database I didn't realize internally it tracked the tag #foo/bar as both the root tag #foo and the child tag #foo/bar. Looks like I'll have to rethink my logic so that I can properly turn #foo/bar into [[foo]][[bar]] (or [[foo]] #bar).
Appreciate the virtual rubber ducking