From e603aef3d96a7e602613634e5ff09b14c96d6b62 Mon Sep 17 00:00:00 2001 From: Alex Rodriguez Date: Thu, 29 Nov 2018 13:55:21 -0600 Subject: [PATCH] change regex pattern for dynamic routes to accept hyphens and underscores --- src/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index a01221c..761ec66 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,4 +1,4 @@ -const DYNAMIC_PATH_REGEX = '[a-zA-Z]+' +const DYNAMIC_PATH_REGEX = '[0-9A-Za-z._-]+' export const getContent = (options, path, target, pathVariables) => { let { Component, props } = options[path] @@ -37,7 +37,7 @@ export const getPathVariables = (sections, matches) => { export const getPathRegex = sections => { return sections.map((value) => { if (value.match(new RegExp(`:${DYNAMIC_PATH_REGEX}`)) !== null) { - return `([a-zA-Z0-9]+)` + return `([0-9A-Za-z._-]+)` } return value }).join('\\/')