title: CakePHP routes regular expression for unicode
body: <p>I want to do the following change in CakePHP routes. Any word or group of words (separated by hyphen) after a website URL like <code>example.com/someword</code> or <code>example.com/some-word</code> should be redirected to <code>controller =&gt; posts, action =&gt; view</code>. But my problem is that the word(s) should be in unicode. I have tried this regular expression for URL text, but it does not work.</p>
  
  <blockquote>
    <p>Router::connect ( '/:link', array ('controller' => 'posts', 'action' => 'view' ), array ('pass' => array ('link'), 'link' => '/^['.json_decode('"\u0531"').'-'.json_decode('"\u0587"').'-]+$/u' ) );</p>
  </blockquote>
  
  <p>I want to mention though, that my regex </p>
  
  <pre><code>'/^['.json_decode('"\u0531"').'-'.json_decode('"\u0587"').'-]+$/u',
  </code></pre>
  
  <p>works just fine if I am about to do some usual preg_match like</p>
  
  <pre><code>$regg = '/^['.json_decode('"\u0531"').'-'.json_decode('"\u0587"').'-]+$/u';
  if (preg_match($regg, "my unicode string", $match)) {
    var_dump($match);   // outputs string as expected
  }
  die;
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>I end up having this code </p>
  
  <pre><code>Router::connect ( '/:link', array ('controller' =&gt; 'posts', 'action' =&gt; 'view' ), array    ('pass' =&gt; array ('link'), 'link' =&gt; '((?![a-zA-Z]).)+' ) ); 
  </code></pre>
  
  <p>like making my url to contain everything, but English letters, but this is not the thing I need, if I have 2 or more different languages than English - this method won't work. So, I want to send each language's word into separate action.</p>
  
  <p>cake version 2.x</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>There are alternative solutions, like in answers below, to bypass the question, but I am looking for the exact way of doing what I need.</p>
  
  <p>Thanks</p>