How to detect negative number in Zend Framework Router Regex
-
05-07-2019 - |
Question
I have the following .ini configuration working fine for positive integers, but not negative integers.
routes.nd.type = "Zend_Controller_Router_Route_Regex"
routes.nd.route = "news/(\d+)/d"
routes.nd.defaults.controller = "news"
routes.nd.defaults.action = "display"
routes.nd.map.id = 1
How to make it detect negative integers? Apparently \d+
ignores negative numbers.
Can't find this in ZF docs.
regards
Solution
Negative values:
"news/(-\d+)/d"
OTHER TIPS
Postitive or Negative values:
"news/(-?\d+)/d"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow