我正在尝试在这样的 zend 表单元素上使用正则表达式验证器-
$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');
我只是想验证文本区域是否包含逗号分隔的数字列表。
目前我收到“使用模式 '^\d{1,3}([,]\d{1,3})*$' 时出现内部错误”。
我猜正则表达式有问题?
任何帮助,将不胜感激 :)
谢谢,皮特