getExpressMiddleware helper: Avoid calling undefined method when req.route.name is a RegExp.