-2

I've following regular expression configured in ZendFrame work routing

'constraints' => array(
 'controller' => '[a-zA-Z0-9_-]*',
 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
 'dashname' => '[a-zA-Z0-9_-\s]*',
 'formatter' => '[a-zA-Z]*'
 )

throwing error Warning: preg_match(): Compilation failed: invalid range in character class at offset 100 in app\vendor\zendframework\zendframework\library\Zend\Mvc\Router\Http\Segment.php on line 370

Issue seems to be with 'dashname' => '[a-zA-Z0-9_-\s]*',

Same code works in PHP 5.4 version but not in PHP5.6 version, Any help is appreciated.

Praveen Govind
  • 2,619
  • 2
  • 32
  • 45

1 Answers1

4

In class - is a range operator you need to escape it with \

[a-zA-Z0-9_\-\s]

Robert
  • 19,800
  • 5
  • 55
  • 85