We can use regular expressions to more precisely define the paths to our routes in React Router v4.
To add regex for router, we only need to add (), inside (), we can write regex:
<Route path="/:date(\d{2}-\d{2}-\d{4}):ext(.[a-z]+)" children={({match}) => { const date = match.params.date; const ext = match.params.ext; return match && <h2>demo: {date}{ext}</h2> }}></Route>