title: React Router V4 allow only certain parameters in URL
body: <p>I'm using the React Router V4 and I've this router's configuration:</p>
  
  <pre><code>  &lt;Router history={customHistory}&gt;
      &lt;Switch&gt;
        &lt;Route exact path={`/:lng?`} component={Page} /&gt;
        &lt;Route path={`/:lng?/firstUrl`} component={Page}/&gt;
        &lt;Route path={`/:lng?/secondUrl`} component={Page}/&gt;
        &lt;Route component={NoMatch} /&gt;
      &lt;/Switch&gt;
    &lt;/Router&gt;
  </code></pre>
  
  <p>The <code>lng</code> is optional language parameter which should match pattern like a <code>en</code>, <code>de</code> or absent.
  For instance app utilizes these routes:</p>
  
  <pre><code>www.website.com/en
  www.website.com/en/
  www.website.com/  - will load default lang
  www.website.com  - will load default lang
  www.website.com/de
  www.website.com/de/
  </code></pre>
  
  <p>Also I've additional component inside which I define routes for functions:</p>
  
  <pre><code>  &lt;ModalRoute component={SomeURL} path={`/:lng?/SomeURL`} parentPath={`/${lang}/`} /&gt;
    &lt;ModalRoute component={SomeURL2} path={`/:lng?/SomeURL2`} parentPath={`/${lang}/`} /&gt;
  </code></pre>
  
  <p>So as the result I would like to achieve that only allowed language codes (and empty param) would be accepted and which don't - would be redirected to <code>NoMatch</code> component.</p>
  
  <p>Is it possible? How it could be achieved?<br>
  Example much appreciated</p>