Reputation: 65
Hi I am trying to pass a regex expression in zf2 routing, My router looks like this :
'exampleroute' => array(
'type' => 'segment',
'options' => array(
'route' => '/exampleroute/[:regexparameter]',
'constraints' => array(
'regexparameter' => '[a-zA-Z][a-zA-Z0-9_-][$.]*',
),
'defaults' => array(
'__NAMESPACE__' => 'Mynamespace\Controller',
'controller' => 'exampleroute',
'action' => 'example',
),
),
),
I want to pass the following URL: http://mydomain.com/exampleroute/$2y$14$aPW5u7oGpuuMPRKRz6la1.m2SpJ2STFJ9BZ7giSwfKQxWKIuTODmW
but it gives me an error of "The requested URL could not be matched by routing."
Upvotes: 0
Views: 1902
Reputation: 65
Its Working like this now:
'exampleroute' => array(
'type' => 'segment',
'options' => array(
'route' => '/exampleroute/[:regexparameter]',
'constraints' => array(
'regexparameter' => '[$.a-zA-z0-9_-]*',
),
'defaults' => array(
'__NAMESPACE__' => 'Mynamespace\Controller',
'controller' => 'exampleroute',
'action' => 'example',
),
),
),
Upvotes: 0
Reputation: 10003
[a-zA-Z][a-zA-Z0-9_-][$.]*
means:
a-zA-Z
a-zA-Z0-9_-
$
or .
symbolsI guess you need this:
[a-zA-Z0-9_-$.]*
Upvotes: 2