Beb Pratza Ballus Beb Pratza Ballus - 7 months ago 23
PHP Question

Zend_Validate_InArray with array of pattern

I wrote a validate regex in a Zend form:

$card = new Zend_Validate_Regex(
array('pattern' => '/1234*/',)
);
$card->setMessage($this->getView()->translate('ERROR_CARD_FORMAT'));


I need to add different patterns:

$card = new Zend_Validate_Regex(
array('pattern' => '/1234*/','pattern'=> '/4534*/')
);


I tryed also with Zend InArray validator, but I need to set different patterns, not a specifical string. Anyone can help me?

Answer

use meta-character |

'pattern' => '/1234*|4534*/'

http://php.net/manual/en/regexp.reference.meta.php

Comments