Thursday, May 5, 2011

How to detect negative number in Zend Framework Router Regex

Hi

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

From stackoverflow
  • Negative values:
    "news/(-\d+)/d"
    
    uuɐɯǝʃǝs : Great! Many thanks!
  • Postitive or Negative values:

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

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.