TYPO3 CMS  TYPO3_6-2
RegularExpressionValidator.php
Go to the documentation of this file.
1 <?php
3 
23 
24 
28  protected $supportedOptions = array(
29  'regularExpression' => array('', 'The regular expression to use for validation, used as given', 'string', TRUE)
30  );
31 
40  public function isValid($value) {
41  $result = preg_match($this->options['regularExpression'], $value);
42  if ($result === 0) {
43  $this->addError(
44  $this->translateErrorMessage(
45  'validator.regularexpression.nomatch',
46  'extbase'
47  ), 1221565130);
48  }
49  if ($result === FALSE) {
50  throw new \TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationOptionsException('regularExpression "' . $this->options['regularExpression'] . '" in RegularExpressionValidator contained an error.', 1298273089);
51  }
52  }
53 }
addError($message, $code, array $arguments=array(), $title='')
translateErrorMessage($translateKey, $extensionName, $arguments=array())