New tag parsing algorithm to allow embedded variable tags