Giuliano Riccio wrote:
Try this:

     $route = new Zend_Controller_Router_Route_Regex(
      'foo/(\d+)(?:/(\w+))?',
       array(
         'module' => 'MyModule',
         'controller' => 'Foo',
         'action' => 'index'
       ),
       array(
         1 => 'id',
         2 => 'action'
       ),
       'foo/%d/%s'
);
"?:" at the begin of the second match will tell PHP to ignore it.
I didn't try it but should work.

Ohhhh, nice! That works perfectly.... That's very handy to know about regexps when used in this way.

Perfect. Thanks for that Giuliano. A new tool added to my regexp armoury!
http://xkcd.com/208/

:p

Col

PS I still cant think of a reason to nullify a match in a url at assembly time, but I wont loose sleep over it :D

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

Reply via email to