Parses a match validation field.

@param array  $input - Input to be validated
@param string $key   - Validation key
@param string $match - The option looking to be matched up with $key
@param string $lang  - Language string

@return string
514843
public function match($input, $key, $match, $lang)
    {
        $lang = $this->custom('match', $lang);
        if ($input[$key] !== $input[$match]) {
            return preg_replace_callback('/(\:field)(.*)(\:match)/i',
            function ($m) use ($key, $match) {
                return $key.$m[2].$match;
            }, $lang);
        }
    }
399818
public static function selectMatchItem(
        $matchState,
        $matchKey
    ) {
        $matchState = (object) $matchState;
        $matchKey = (string) $matchKey;

        $matchItem = $matchState->match->$matchKey;

        return $matchItem;
    }
1236991
public static function parseNQuads($input) {
    // define partial regexes
    $iri = '(?:<([^:]+:[^>]*)>)';
    $bnode = '(_:(?:[A-Za-z][A-Za-z0-9]*))';
    $plain = '"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"';
    $datatype = "(?:\\^\\^$iri)";
    $language = '(?:@([a-z]+(?:-[a-z0-9]+)*))';
    $literal = "(?:$plain(?:$datatype|$language)?)";
    $ws = '[ \\t]';
    $eoln = '/(?:\r\n)|(?:\n)|(?:\r)/';
    $empty = "/^$ws*$/";

    // define quad part regexes
    $subject = "(?:$iri|$bnode)$ws+";
    $property = "$iri$ws+";
    $object = "(?:$iri|$bnode|$literal)$ws*";
    $graph_name = "(?:\\.|(?:(?:$iri|$bnode)$ws*\\.))";

    // full quad regex
    $quad = "/^$ws*$subject$property$object$graph_name$ws*$/";

    // build RDF dataset
    $dataset = new stdClass();

    // split N-Quad input into lines
    $lines = preg_split($eoln, $input);
    $line_number = 0;
    foreach($lines as $line) {
      $line_number += 1;

      // skip empty lines
      if(preg_match($empty, $line)) {
        continue;
      }

      // parse quad
      if(!preg_match($quad, $line, $match)) {
        throw new JsonLdException(
          'Error while parsing N-Quads; invalid quad.',
          'jsonld.ParseError', null, array('line' => $line_number));
      }

      // create RDF triple
      $triple = (object)array(
        'subject' => new stdClass(),
        'predicate' => new stdClass(),
        'object' => new stdClass());

      // get subject
      if($match[1] !== '') {
        $triple->subject->type = 'IRI';
        $triple->subject->value = $match[1];
      } else {
        $triple->subject->type = 'blank node';
        $triple->subject->value = $match[2];
      }

      // get predicate
      $triple->predicate->type = 'IRI';
      $triple->predicate->value = $match[3];

      // get object
      if($match[4] !== '') {
        $triple->object->type = 'IRI';
        $triple->object->value = $match[4];
      } else if($match[5] !== '') {
        $triple->object->type = 'blank node';
        $triple->object->value = $match[5];
      } else {
        $triple->object->type = 'literal';
        $unescaped = str_replace(
          array('\"', '\t', '\n', '\r', '\\\\'),
          array('"', "\t", "\n", "\r", '\\'),
          $match[6]);
        if(isset($match[7]) && $match[7] !== '') {
          $triple->object->datatype = $match[7];
        } else if(isset($match[8]) && $match[8] !== '') {
          $triple->object->datatype = self::RDF_LANGSTRING;
          $triple->object->language = $match[8];
        } else {
          $triple->object->datatype = self::XSD_STRING;
        }
        $triple->object->value = $unescaped;
      }

      // get graph name ('@default' is used for the default graph)
      $name = '@default';
      if(isset($match[9]) && $match[9] !== '') {
        $name = $match[9];
      } else if(isset($match[10]) && $match[10] !== '') {
        $name = $match[10];
      }

      // initialize graph in dataset
      if(!property_exists($dataset, $name)) {
        $dataset->{$name} = array($triple);
      } else {
        // add triple if unique to its graph
        $unique = true;
        $triples = &$dataset->{$name};
        foreach($triples as $t) {
          if(self::_compareRDFTriples($t, $triple)) {
            $unique = false;
            break;
          }
        }
        if($unique) {
          $triples[] = $triple;
        }
      }
    }

    return $dataset;
  }
123275
protected function setJavascriptValidation($name, $lang, $rule = NULL, $param = [])
    {
        $this->getJavascriptValidationFunction[$name] = $function = $name . md5($name);

        $this->validate[] = $rule ?: $lang;

        return $this->onkeyup($function . '(this, ' . Base::suffix(implode(', ', $param), ', ') . '\''.$this->setCustomValidity($lang).'\')') 
                    ->required();
    }
299062
public function parseString($input, $config = NULL, $encoding = NULL, $input, $config = NULL, $encoding = NULL)
    {
    }
1222881
protected function validate(string $input): bool
    {
        return \Normalizer::isNormalized($input, \Normalizer::FORM_KC)
            && ($this->isRegExp($input) ? $this->validateRegexp($input) : $this->validateCharacters($input));
    }
1036541
protected function validate_iban($field, $input, $param = null)
    {
        if (!isset($input[$field]) || empty($input[$field])) {
            return;
        }

        $character = array(
            'A' => 10, 'C' => 12, 'D' => 13, 'E' => 14, 'F' => 15, 'G' => 16,
            'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20, 'L' => 21, 'M' => 22,
            'N' => 23, 'O' => 24, 'P' => 25, 'Q' => 26, 'R' => 27, 'S' => 28,
            'T' => 29, 'U' => 30, 'V' => 31, 'W' => 32, 'X' => 33, 'Y' => 34,
            'Z' => 35,
        );

        if (!preg_match("/\A[A-Z]{2}\d{2} ?[A-Z\d]{4}( ?\d{4}){1,} ?\d{1,4}\z/", $input[$field])) {
            return array(
                'field' => $field,
                'value' => $input[$field],
                'rule' => __FUNCTION__,
                'param' => $param,
            );
        }

        $iban = str_replace(' ', '', $input[$field]);
        $iban = substr($iban, 4).substr($iban, 0, 4);
        $iban = strtr($iban, $character);

        if (bcmod($iban, 97) != 1) {
            return array(
                'field' => $field,
                'value' => $input[$field],
                'rule' => __FUNCTION__,
                'param' => $param,
            );
        }
    }
456698
public function max($input, $key, $max, $lang)
    {
        $lang = $this->custom('max', $lang);
        if (strlen($input[$key]) > $max) {
            return preg_replace_callback('/(:field)(.*)(\:num)/i',
            function ($m) use ($key, $max) {
                return $key.$m[2].$max;
            }, $lang);
        }
    }
130668
public function url($input, $key, $lang)
    {
        $lang = $this->custom('url', $lang);
        if (filter_var($input[$key], FILTER_VALIDATE_URL) === false) {
            return str_replace(':field', $key, $lang);
        }
    }
298891
private function createLinkOrSeeTagFromRegexMatch(array $match): Tag
    {
        list($completeMatch, $tagName, $tagContent) = $match;

        $fqsenResolver = new FqsenResolver();
        $tagFactory = new StandardTagFactory($fqsenResolver);
        $descriptionFactory = new DescriptionFactory($tagFactory);
        $tagFactory->addService($descriptionFactory);
        $tagFactory->addService(new TypeResolver($fqsenResolver));

        switch ($tagName) {
            case 'see':
                return See::create($tagContent, $fqsenResolver, $descriptionFactory, $this->createDocBlockContext());
            case 'link':
                return Link::create($tagContent, $descriptionFactory, $this->createDocBlockContext());
        }
    }
1065363
private function parseFields($input)
    {
        if (is_array($input)) {
            return $input;
        }

        $fields = [];
        foreach (explode(' ', $input) as $value) {
            $elements = explode(':', $value);
            $name = $elements[0];
            if (strlen($name)) {
                $type = isset($elements[1]) ? $elements[1] : 'string';
                preg_match_all('/(.*)\((.*)\)/', $type, $matches);
                $type = isset($matches[1][0]) ? $matches[1][0] : $type;
                $length = isset($matches[2][0]) ? $matches[2][0] : null;

                $fields[$name] = ['fieldName' => $name, 'type' => $type, 'length' => $length];
            }
        }

        return $fields;
    }
1231030
public static function regexp($input, $regexp, $field_name = 'regexp')
    {
        //Define trivial model
        $model = [
            $field_name => ['type' => Validate::TYPE_REGEXP, 'regexp' => $regexp, Validate::REQUIRED]
        ];

        $parameters = [$field_name => $input];
        Validate::model($parameters, $model);

        return $parameters[$field_name];
    }
561665
static function regx($regx, $input)
    {
        $n = preg_match($regx, $input, $match);
        if ($n === 0)
        {
            return false;
        }
        else
        {
            return $match[0];
        }
    }
1271784
protected function custom($key, $lang)
    {
        return ($this->_replaceWithCustom[$key]) ? $this->_custom[$key] : $lang;
    }
707491
public function tl($key, array $args = [], $lang = null)
    {
        return $this->translate($key, $args, $lang);
    }
799138
public function match($input)
    {
        if ($this->token instanceof Token) {
            if ($this->token->matches($input)) {
                return true;
            }
            return false;
        }
        
        if ($this->token === $input) {
            return true;
        }
        return false;
    }
12884
public function validateDateformats($file, $key, $validate_language)
	{
		if (empty($validate_language))
		{
			$this->output->addMessage(Output::FATAL, 'Array must not be empty', $file, $key);
			return;
		}

		foreach ($validate_language as $dateformat => $example_time)
		{
			$this->validateString($file, $key . '.' . $dateformat, '', $dateformat);
			$this->validateString($file, $key . '.' . $dateformat, '', $example_time);
		}
	}