I'm trying to use a regex validator on a zend form element like this-
$textarea = $this->createElement('text','scores');
$textarea->setLabel('Enter a comma separated list of numbers');
$textarea->setDecorators(
array('ViewHelper',
array('HtmlTag',
array('tag' => 'div',
'class'=>'scores'
)
)
)
);
$textarea->addDecorator('Label')
->setRequired(true)
->addFilter(new Zend_Filter_StringTrim())
->addValidator('regex',true,array('^\d{1,3}([,]\d{1,3})*$'))
->addErrorMessage('Please enter a comma separated list of numbers');
I'm just trying to validate that the text area contains a list of comma separated numbers.
Currently im getting "Internal error while using the pattern '^\d{1,3}([,]\d{1,3})*$'".
I guess there's something wrong with the regex?
Any help would be appreciated :)
thanks, pete