Rework template matching Regexp