I don't get Zend_Validate_Regex working

Posted by poru on Stack Overflow See other posts from Stack Overflow or by poru
Published on 2010-05-22T19:38:30Z Indexed on 2010/05/22 19:40 UTC
Read the original article Hit count: 552

Zend_Validate_Alpha doesn't fit 100% to that what I want and I don't get Zend_Validate_Regex working. I want that the validator just allows a-z/A-Z, 0-9, _ and -. I tried to add the following to one of my inputs:

addValidator('Regex', true, array('pattern' => '/^[a-zA-Z0-9_-]/'))

but for example abc§$%& is a valid input says the Zend Validator. What am I doing wrong?

© Stack Overflow or respective owner

Related posts about zend-framework

Related posts about zend-form