Improving regexp of template engine