public function validate($value) { if ($this->unicode) { $this->regexp = '/^([^@\\s]+)@((?:[-\\p{L}\\p{N}]+\\.)+[a-z]{2,})$/iu'; } else { $this->regexp = '/^[a-z0-9' . preg_quote("!#\$%&'*+/=?^_`{|}~.-", '/') . ']{1,}@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i'; } return parent::validate($value); }
public function validate($value) { $whitespace = $this->whitespace ? '\\s' : ''; // unicode characters for numerals can be 2/5 i.e. ⅖ if ($this->unicode) { $this->regexp = '@^[\\p{N}.' . $whitespace . ']+$@u'; } else { $this->regexp = '@^[0-9.' . $whitespace . ']+$@'; } return parent::validate($value); }