Improving template engine regexp