Defining regexp in URL rules only once

Hi. I’ve a bunch of URL rules like these:




array(

 'post/<p:\+?\d+>/create' => 'post/create',

 'account/<p:\+?\d+>/read' => 'account/read',

 'post/<p:\+?\d+>' => 'post',

 // more rules goes here ...

)



The problem is that I’ve a regular expression which is duplicated many times. Is it possible somehow to define a <p:\+?\d+> part only once for rules?

No

Try this way:




array(

'<controller:\w+>/<p:\+?\d+>/<action:\w+>' => '<controller>/<action>',

'<controller:\w+>/<p:\+?\d+>' => '<controller>',

)