I've tested my regular expression on multiple testers and I've tried multiple regular expressions too but I keep getting the error: "Internal error while using the pattern '/^(04\\d{2}/(\\d{2} )\\d{2} \\d{2})$/'". I know it's probably not the best regex but I couldn't find a good one and I'm not really a pro at this and I have to move on. The phone numbers it should be matching are 04dd/dd dd dd with d being a number between 0 and 9. This is the code I'm using when creating the form.
$phone = $this->addElement('text', 'phone', array(
'filters' => array('StringTrim'),
'validators' => array(
array('regex', false, array('/^(04\d{2}/(\d{2} )\d{2} \d{2})$/'))
),
'required' => true,
'label' => 'Phone:',
));
How can I solve this problem? Thanks already.
您必须逃脱斜线:
array('regex', false, array('/^(04\d{2}\/(\d{2} )\d{2} \d{2})$/'))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.