replace lookahead regex with two separate template parsers