Step5: Converts the token of the matched range.

@param int         $i
@param string      $match
@param array       $matches
@param null|string $special
@param null|string $replace
771526
protected function matchRangeTokenStep5($i, $match, array &$matches, &$special, &$replace)
    {
        $matches[$i] = $this->convertVersion($match);
        $matches[$i] = $replace
            ? SemverUtil::replaceAlias($matches[$i], $replace)
            : $matches[$i];
        $matches[$i] .= '~' === $special && \in_array($replace, array('<', '>'), true)
            ? ','.$replace.$matches[$i]
            : '';
        $special = null;
        $replace = null;
    }
284920
private function orElseMatch(Match $match)
    {
        return array_key_exists($this->subject->getName(), $this->matches)
            ? $this->matches[$this->subject->getName()]->get()
            : $match->get();
    }
390986
public function match(array $matches) {
        $params = explode(' ', $matches[1]);
        $paramsNum = count($params);
        $this->params[] = $params[0];

        if (1 == $paramsNum) {
            return sprintf($this->defaultRegx['char'], '+');
        }
        else if (2 == $paramsNum) {
            return sprintf($this->defaultRegx[$params[1]], '+');
        }
        else if (3 == $paramsNum) {
            return sprintf($this->defaultRegx[$params[1]], $params[2] > 0 ? '{' . $params[2] . '}' : '*');
        }
        else if (4 == $paramsNum) {
            return sprintf($this->defaultRegx[$params[1]], '{' . $params[2] . ',' . $params[3] . '}');
        }
    }
393480
protected function normalizeMatches($matches)
    {
        return collect($matches)
            ->filter(function ($item, $key) {
                return ! is_numeric($key);
            })
            ->map(function ($item, $key) {
                $return = $item[0];

                if (starts_with($key, 'load')) {
                    $return = floatval($return);
                } elseif (is_numeric($return)) {
                    $return = (int) $return;
                } elseif (empty($return)) {
                    $return = null;
                }

                return $return;
            })
            ->toArray();
    }
364577
private function translateNthChild(array $match)
    {
        $parseResult = $this->parseNth($match);

        if (isset($parseResult[self::MULTIPLIER])) {
            if ($parseResult[self::MULTIPLIER] < 0) {
                $parseResult[self::MULTIPLIER] = abs($parseResult[self::MULTIPLIER]);
                $xPathExpression = sprintf(
                    '*[(last() - position()) mod %1%u = %2$u]/self::%3$s',
                    $parseResult[self::MULTIPLIER],
                    $parseResult[self::INDEX],
                    $match[1]
                );
            } else {
                $xPathExpression = sprintf(
                    '*[position() mod %1$u = %2$u]/self::%3$s',
                    $parseResult[self::MULTIPLIER],
                    $parseResult[self::INDEX],
                    $match[1]
                );
            }
        } else {
            $xPathExpression = sprintf('*[%1$u]/self::%2$s', $parseResult[self::INDEX], $match[1]);
        }

        return $xPathExpression;
    }
781875
private function findPattern($matches) {
        switch ($matches[1]) {
            case ':num':
                $replacement = '([0-9]';
                break;
            case ':alpha':
                $replacement = '([a-zA-Z]';
                break;
            case ':any':
                $replacement = '([^\/]';
                break;
        }


        if (isset($matches[3]) && is_numeric($matches[3])) {
            if (isset($matches[4]) && $matches[4] == '?') {
                $replacement .= '{0,' . $matches[3] . '})';
            } else {
                $replacement .= '{' . $matches[3] . '})';
            }
        } else {
            if (isset($matches[4]) && $matches[4] == '?') {
                $replacement .= '*)';
            } else {
                $replacement .= '+)';
            }
        }

        return $replacement;
    }
751793
private function convertToColumn(array &$match): void
    {
        if ($this->persistenceStrategy instanceof MariaDBIndexedPersistenceStrategy) {
            $indexedColumns = $this->persistenceStrategy->indexedMetadataFields();
            if (\in_array($match['field'], \array_keys($indexedColumns), true)) {
                $match['field'] = $indexedColumns[$match['field']];
                $match['fieldType'] = FieldType::MESSAGE_PROPERTY();
            }
        }
    }
307803
protected function calculeInverted(array $matches): string
    {
        $prefix = $matches[1];
        $negation = '' === $matches[2] ? 'Not' : '';
        $name = $matches[3];

        $inverted = sprintf('%s%s%s', $prefix, $negation, $name);

        return $inverted;
    }
850574
public function matching ($pattern, &$matches = [], $flags = 0, $offset = 0, $start = 0, $end = null) {
		if (is_null($end)) {
			$end = $this->_length;
		}
		return static::Match($pattern, static::Substring($this->_string, $start, $end), $matches, $flags, $offset);
	}
660437
public static function replace($match, $replace, $org)
    {
        //if $match satisfies regular expression
        if (is::regex($match)) {
            return preg_replace($match, $replace, $org);
        } else {
            return str_replace($match, $replace, $org);
        }
    }
1325186
function tokenizeEvaluate(match, value) {
    var index = tokenized.length;
    tokenized[index] = "';\n" + value + ";\n__p += '";
    return token + index;
  }
249477
public function basedInt($matches)
    {
        $base = $matches[1];
        $match = $matches[0];
        $this->posShift(strlen($matches[0]));
        $number = null;
        if ($base >= 2 && $base <= 16) {
            $number = $this->scan($this->buildBasedIntRegex((int)$base));
        }
        if ($number !== null) {
            $match .= $number;
        }
        $this->record($match, 'NUMERIC');
        // now we're going to greedily consume any trailing numbers
        // This handles the case e.g. 2#001122,
        // we don't want the '22' to get caught as a separate literal, we want to
        // make sure it's NOT highlighted as a literal
        // so we consume it here.
        if ($this->scan('/\d+/') !== null) {
            $this->record($this->match(), null);
        }
    }
1027052
private function findString($i, array $matches)
    {
        $string = isset($matches[0][$i]) ? $matches[0][$i] : '';


        return substr($string, 1, -1);
    }
1155065
protected function remove_iunreserved_percent_encoded($match)
	{
		// As we just have valid percent encoded sequences we can just explode
		// and ignore the first member of the returned array (an empty string).
		$bytes = explode('%', $match[0]);

		// Initialize the new string (this is what will be returned) and that
		// there are no bytes remaining in the current sequence (unsurprising
		// at the first byte!).
		$string = '';
		$remaining = 0;

		// Loop over each and every byte, and set $value to its value
		for ($i = 1, $len = count($bytes); $i < $len; $i++)
		{
			$value = hexdec($bytes[$i]);

			// If we're the first byte of sequence:
			if (!$remaining)
			{
				// Start position
				$start = $i;

				// By default we are valid
				$valid = true;

				// One byte sequence:
				if ($value <= 0x7F)
				{
					$character = $value;
					$length = 1;
				}
				// Two byte sequence:
				elseif (($value & 0xE0) === 0xC0)
				{
					$character = ($value & 0x1F) << 6;
					$length = 2;
					$remaining = 1;
				}
				// Three byte sequence:
				elseif (($value & 0xF0) === 0xE0)
				{
					$character = ($value & 0x0F) << 12;
					$length = 3;
					$remaining = 2;
				}
				// Four byte sequence:
				elseif (($value & 0xF8) === 0xF0)
				{
					$character = ($value & 0x07) << 18;
					$length = 4;
					$remaining = 3;
				}
				// Invalid byte:
				else
				{
					$valid = false;
					$remaining = 0;
				}
			}
			// Continuation byte:
			else
			{
				// Check that the byte is valid, then add it to the character:
				if (($value & 0xC0) === 0x80)
				{
					$remaining--;
					$character |= ($value & 0x3F) << ($remaining * 6);
				}
				// If it is invalid, count the sequence as invalid and reprocess the current byte as the start of a sequence:
				else
				{
					$valid = false;
					$remaining = 0;
					$i--;
				}
			}

			// If we've reached the end of the current byte sequence, append it to Unicode::$data
			if (!$remaining)
			{
				// Percent encode anything invalid or not in iunreserved
				if (
					// Invalid sequences
					!$valid
					// Non-shortest form sequences are invalid
					|| $length > 1 && $character <= 0x7F
					|| $length > 2 && $character <= 0x7FF
					|| $length > 3 && $character <= 0xFFFF
					// Outside of range of iunreserved codepoints
					|| $character < 0x2D
					|| $character > 0xEFFFD
					// Noncharacters
					|| ($character & 0xFFFE) === 0xFFFE
					|| $character >= 0xFDD0 && $character <= 0xFDEF
					// Everything else not in iunreserved (this is all BMP)
					|| $character === 0x2F
					|| $character > 0x39 && $character < 0x41
					|| $character > 0x5A && $character < 0x61
					|| $character > 0x7A && $character < 0x7E
					|| $character > 0x7E && $character < 0xA0
					|| $character > 0xD7FF && $character < 0xF900
				)
				{
					for ($j = $start; $j <= $i; $j++)
					{
						$string .= '%' . strtoupper($bytes[$j]);
					}
				}
				else
				{
					for ($j = $start; $j <= $i; $j++)
					{
						$string .= chr(hexdec($bytes[$j]));
					}
				}
			}
		}

		// If we have any bytes left over they are invalid (i.e., we are
		// mid-way through a multi-byte sequence)
		if ($remaining)
		{
			for ($j = $start; $j < $len; $j++)
			{
				$string .= '%' . strtoupper($bytes[$j]);
			}
		}

		return $string;
	}
31584
protected function doReplaceNameInExpression($matches)
    {
        $key = $matches[0];
        list($column, $realFullColumnName) = $this->getColumnFromName($key);

        if ($column instanceof ColumnMap) {
            $this->replacedColumns[] = $column;
            $this->foundMatch = true;

            if (false !== strpos($key, '.')) {
                list($tableName, $columnName) = explode('.', $key);
                $realColumnName = substr($realFullColumnName, strrpos($realFullColumnName, '.') + 1);
                if (isset($this->aliases[$tableName])) {
                    //don't replace a alias with their real table name
                    return $this->quoteIdentifier($tableName.'.'.$realColumnName);
                }
            }

            return $this->quoteIdentifier($realFullColumnName);
        }

        return $this->quoteIdentifier($key);
    }
930002
protected function _translate($matches)
    {
        $replacement = '';
        $translator = $this->getObject('translator');

        switch ($matches[0])
        {
            case 'D':
                $replacement = $translator->translate(strtoupper($this->_date->format('D')));
                break;

            case 'l':
                $replacement = $translator->translate(strtoupper($this->_date->format('l')));
                break;

            case 'F':
                $replacement = $translator->translate(strtoupper($this->_date->format('F')));
                break;

            case 'M':
                $replacement = $translator->translate(strtoupper($this->_date->format('F').'_SHORT'));
                break;
        }

        $replacement = preg_replace('/([a-z])/i', '\\\\$1', $replacement);

        return $replacement;
    }
286524
public static function hasHtml($string, &$matches = array(), $ifAll = false) {
		return 0 < self::validateByRegExp('/<(.*)>.*|<(.*)\/>/', $string, $matches, $ifAll);
	}