Regex for a-z , hypen (-) and å ä ö in Zend Route Regex
-
07-07-2019 - |
Question
I want to route url through Zend route regex with Swedish character and here is my regex in xml configuration:
..... ([a-z\-å|ä|ö]+) .....
Still, the route doesn't behave as I expect. It doesn't redirect when the link contains å, ä, or ö
I have tried to change to [a-zåäö\-]+ but it also gives the same result..
anyone can help? Thank you so much in advance! :)
Solution
I'm not sure about Zend route, but when using, for instance, preg_match
, you may want to go for something like
preg_match('/[a-zåä]/u',$url);
(note the u for unicode). Another possibility is that your data is %-escaped.
And I'm not sure what [a-z-å|ä|ö]
supposed to mean…
OTHER TIPS
I think the browser would encode those characters and not sure Zend Framework decode it before passing it to the route engine, can you try a regexp with the % equivalent of those characters ?