How to detect negative number in Zend Framework Router Regex

I have the following .ini configuration that works 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 get negative integers to be detected? Apparently \d+

ignores negative numbers.

Can't find this in the ZF docs.

considers

0


source to share


2 answers


Negative values:
"news/(-\d+)/d"

      



+2


source


Positive or negative values:



"news/(-?\d+)/d"

      

+1


source







All Articles